Send a request to a server and need to send the header 'Content-Type': 'application/json'
all this is done with fetch, but because of crossdomain have to specify
mode: 'no-cors',
And in this mode, the browser defaults to - 'Content-Type': 'text/plain'
Actually, this is the problem, since 415 error is returned Here is the entire request code
realFetch(url {
method: 'POST',
mode: 'no-cors',
cache: 'no-cache',
credentials: "same-origin",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(dataUser)
}).
Prompt how to solve this problem? How to force the browser to change headers using fetch?