Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting content-type to 'application/json' on POST seems to be broken #258

Open
nicbarker opened this issue Dec 18, 2016 · 2 comments
Open

Comments

@nicbarker
Copy link

nicbarker commented Dec 18, 2016

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
Copy link

Configuration headers

@ottaviano
Copy link

it seems to work:

contentType: 'application/json',
data: JSON.stringify(data),
processData: false,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants