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

Unable to set Content-Type Header in POST request #155

Open
NiiMER opened this issue Jan 16, 2018 · 3 comments
Open

Unable to set Content-Type Header in POST request #155

NiiMER opened this issue Jan 16, 2018 · 3 comments

Comments

@NiiMER
Copy link

NiiMER commented Jan 16, 2018

While using fetch from isomorphic-fetch it can't send the request in application/json type, it keeps sending plain/text.

After using fetch from node-fetch plugin it works!!

@kaistullich
Copy link

When calling ‘fetch()’, for the 2nd parameter do you define a ‘headers’ key:value?

@NiiMER
Copy link
Author

NiiMER commented Jan 21, 2018

Yes like the following:
fetch('http://example.domain/api/v0.2/login/', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ userName: this.state.usernameOrEmail, password: this.state.password, }), cridentials: 'include', mode: 'no-cors', })

@gary1410
Copy link

gary1410 commented Feb 7, 2018

Do you get back and OPTIONS request?

Also, this might be a CORs issue.

JakeChampion/fetch#143 (comment)

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