Unable to set Content-Type Header in POST request
NiiMER opened this issue · 3 comments
NiiMER commented
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 commented
When calling ‘fetch()’, for the 2nd parameter do you define a ‘headers’ key:value?
NiiMER commented
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 commented
Do you get back and OPTIONS request?
Also, this might be a CORs issue.