-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When parsing JSON in FormData, creates an exception #12
Comments
Hi you have a syntax error inside of your code,
|
I have it just like that. |
This is how my FormData is composed. First part json and then all the files to be sent. let formData = new FormData();
const json = JSON.stringify({
autor: data.autor,
dataLimite: data.dataLimite.toISOString().slice(0, 10),
dataOcorrencia: data.dataOcorrencia.toISOString().slice(0, 10),
descricao: data.descricao,
infoAdicional: data.infoAdicional,
origem: data.origem,
titulo: data.titulo,
});
formData.append("document", json);
if (acceptedFiles.length > 0) {
acceptedFiles.forEach((f) => {
formData.append("files[]", f, f.name);
});
} This is how I get the JSON information in the server const {
autor,
dataLimite,
dataOcorrencia,
descricao,
infoAdicional,
origem,
titulo,
} = JSON.parse(req.body.document); |
hey any solution to this. ?? |
on further investigation i have found out that if you keep sql:false then it transmits multipart form data how ever when u keep sql as true then in that case it does transmit .. so the bug has got something to do with the sql module |
It seems to have to do also with having it on verification of headers normally formdata content type looks like this Having the middleware makes it look like this |
If I remove the middleware it starts working.
The text was updated successfully, but these errors were encountered: