Open NiiMER opened 6 years ago
When calling ‘fetch()’, for the 2nd parameter do you define a ‘headers’ key:value?
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', })
Do you get back and OPTIONS request?
Also, this might be a CORs issue.
https://github.com/github/fetch/issues/143#issuecomment-106774938
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!!