Fail to save Set-cookies data to browser
See original GitHub issueI am using Chrome 48 and found that it is not able to save the set-cookies details into the browser and therefore I am not able to use isomorphic-fetch to do any cookies/ login related api request. I have been calling an api by code like this:
fetch("/accounts/register/", { method: 'post', headers: { "X-CSRFToken": CSRF.getToken(), "Accept": 'application/json', "Content-Type": 'application/json' }, body: JSON.stringify(payload) }).then(response => { if (response.status == 302) { dispatch(receiveRegistration()) return Promise.reject() } else { return response } }).then(response => response.json().then(json => ({json, response})) ).then(({ json, response }) => { if (!response.ok) { dispatch(failRegistration(json)) } else { dispatch(receiveRegistration()) } })
Please kindly advise if I have been using isomorphic-fetch wrongly or this is actually caused by the underlying “fetch polyfilly” library.
Thanks a lot.
Issue Analytics
- State:
- Created 8 years ago
- Comments:15
Top GitHub Comments
It’s weird. In your case in https://github.com/koajs/koa/issues/689, the requests are all belong to the same domain which is
9.xiaojukeji.com
, i think{credentials: 'same-origin'}
is not necessary. Did i miss something?My call to fetch endeup like this fetch(url, {credentials: ‘same-origin’}) And it worked for me!