I am trying to send a form to an endpoint but I get an error forbidden 403, and I already tried with an api test and the endpoint works perfectly
const SendData = (event) => {
event.preventDefault();
let respuestasUSer = new FormData();
respuestasUSer.set('curso', state.curso)
respuestasUSer.set('nombre', state.nombre)
respuestasUSer.set('q1', state.Pregunta1)
respuestasUSer.set('q2', state.Pregunta2)
respuestasUSer.set('q3', state.Pregunta3)
respuestasUSer.set('q4', state.Pregunta4)
respuestasUSer.set('q5', state.Pregunta5)
respuestasUSer.set('q6', state.Pregunta6)
respuestasUSer.set('q7', state.Pregunta7)
respuestasUSer.set('q8', state.Pregunta8)
axios({
method: "post",
url: "https://covid.cit0.com/guardar/encuesta/",
data: respuestasUSer,
headers: { "Content-Type": "multipart/form-data" },
})
.then(function (response) {
//handle success
console.log(response);
})
.catch(function (response) {
//handle error
console.log(response);
});
}
In the api test I do it like this and it works for me, how could I pass this same content to axios?