-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Fetch API corrupts repetitive response headers #12846
Comments
React Native also appears to discard cookie path (and perhaps domain) when automatically sending |
TL; DR: I think React Native is more or less doing things correctly here, but it would be nice if it followed the example of Node.js and special-cased Long version with citations: In reading things this morning, and talking to folks behind the Fetch spec, React Native seems to be following the fetch spec correctly, with the exception of allowing access to The header combining behavior is allowed (but not required) according to the HTTP RFC, and also mentioned in the cookie RFC:
It can be rather difficult to combine a combined Set-Cookie header since, for example, a expires field can contain the same ", " separator that is used to combine multiple headers into one. The Fetch spec takes things a step further and requires this combining behavior. Fetch folks are aware that it doesn't work well for cookies but require the behavior anyways since their spec doesn't allow access to So, as I said above, special-casing cookies and/or providing raw header access would be very beneficial here. Looking at the code, that may be easier said then done... Also, regarding this:
I believe this is the correct behavior. |
Just wanted to clarify regarding:
React Native's |
I am the owner of Basically there are 2 issues to be fixed for
As for the cookie path issue, I think its a You can follow up on a similar issue on node-fetch/node-fetch#251 EDIT: also note for |
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally! If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution. |
This is still an issue and shouldn't be closed. |
I know this ticket is pretty old, but I think I finally have a good solution. Thanks to a PR from @chrusart, the Please test it out and let me know how it works for you. |
Description
The Fetch API misinterprets repetitive response headers, for instance,
Set-Cookie
header passed separately for each cookie. All values of the header concatenate into a single string unusable for further processing.Reproduction
Expected result:
Actual result:
Solution
The underlying platform-specific code that implements the Fetch API needs to be fixed.
Additional Information
The text was updated successfully, but these errors were encountered: