I'm messing around with react and trying to make a put request to an api. I'm trying to send my body as content-type application/json but it keeps sending as text/plain. If I add the header "Content-Type" : "application/json" I just get this as the return.
Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response.
I'm using this api : http://funtranslations.com/api/yoda
Here is my request:
fetch('http://api.funtranslations.com/translate/yoda.json', {
method: 'PUT',
body: JSON.stringify({
text: this.state.input
})
})
.then(res => {
return console.log(res.json());
})
}
Thank you in advance for attempting to help me :)