I am trying to send an object within a multipart/form-data request, the problem is that no matter what I do, I get this error: 'Content type 'application/octet-stream' not supported'. It's the same error that I get when I delete the 'application/json' content type from postman. I have tried different solutions that were suggested in similar questions but none of those worked.
This is how it should be configured in postman to work: postman request
And this is the request that returns the error mentioned above:
const data = JSON.stringify(values);
const formData = new FormData();
formData.append('metadata', data);
return await axios.post(
url,
formData
);
It works for me, try this:
const json = JSON.stringify(values);
const dataTemp = new Blob([json], {
type: 'application/json'
});
var formData = new FormData();
formData.append('metadata', dataTemp);
Apologize if it does not work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.