I am fetching a URL like this:
fetch(url, {
mode: 'no-cors',
method: method || null,
headers: {
'Accept': 'application/json, application/xml, text/plain, text/html, *.*',
'Content-Type': 'multipart/form-data'
},
body: JSON.stringify(data) || null,
}).then(function(response) {
console.log(response.status)
console.log("response");
console.log(response)
})
My API expects the data to be of multipart/form-data
so I am using content-type
of this type... But it is giving me a response with status code 400.
What's wrong with my code?