Setting content-type to 'application/json' on POST seems to be broken
nicbarker opened this issue · 2 comments
nicbarker commented
Hi,
I'm not sure if this repo is still maintained, but I can't seem to manage to set the request Content-Type
header to application/json
. The following code results in it being set to application/x-www-form-urlencoded
:
reqwest({
method: 'POST',
url: url,
withCredentials: true
data: JSON.stringify(data),
type: 'json',
crossOrigin: true,
contentType: 'application/json',
headers: { 'Content-Type': 'application/json' }
})
This is in Chrome OSX, 54.0.2840.98.
Any ideas?
jonattanva commented
ottaviano commented
it seems to work:
contentType: 'application/json',
data: JSON.stringify(data),
processData: false,