-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
no longer returns all rows of the same-name response headers after RN Upgrade
#18837
Comments
This btw JUST STARTED!! so dont tell me the code / server etc is wrong.. cause it was working for long while |
Also have same issue after upgrading RN version 0.53 to 0.55. fetch() is not returning body returned by the server. When I downgraded to RN version 0.53, it works well. Please give the solution. |
So ive upgraded to latest commit and still same issue: Packages: (wanted => installed) |
I have just resolved this problem by converting fetch() response into json using response.json() method, which in-turns, returns a promise which returns the actual response from server using .then(). fetch('https://facebook.github.io/react-native/movies.json') reference: https://facebook.github.io/react-native/docs/network.html |
@ajaykumar97 your problem was with the |
Fetch
no longer returns all rows of the same-name response headers after RN Upgrade
I've also just ran into this problem. It seems to be an issue with the |
Awesome man @ciaranw thanks for the investigation. I hope someone picks it up and solves it.. As a temporary solution I had to push the CSRF tokens from the api framework into the body instead.. |
I suspect the issue was introduced in commit 7891805 but i'm not an expert on android or C++ so I can't be sure! |
Our app was also affected by this when trying to update to 0.55.4. It breaks use case of reading cookies from responses as there's often more than one |
@jmheik |
I'm seeing the same thing happening since upgrading from RN 0.52 to 0.54. Headers being returned by some servers we use have the same fields spread across multiple lines. Since 0.54 it is not possible to talk to these devices any more using RN on Android! RN on iOS is fine. |
Same issue affect our app when moving from RN 0.52 The server we are connecting to returns Basic & Digest authentication headers but in the Android app we only get the Basic authentication header returned. The same servers work OK on iOS |
We were affected by this issue after upgrading our Android app from RN 0.53.3 to RN 0.54.4, and I see that it's still an issue in RN 0.55.4. We're using an API that returns multiple |
I found a workaround for this issue, but I'm not sure of any additional implications of it. Inspired by comments on a
I created a repo to reproduce the issue using 0.55.4: https://github.com/patricksmith/rn-headers. You can see the workaround in this commit: patricksmith/rn-headers@e666aa8. I can't find any documentation on what |
I've been trying to deal with this issue for a while. The fix above seems to do nothing to fix the issue for me. I still only see an array of a single value in the "set-cookie" header. |
Facing the same issue, spent the morning trying to debug why on iOS we had 3 cookies and on Android only 1 cookie and the problem happens when there are more headers with the same name, on Android it takes only the last one ignoring the others. An easy way to reproduce, using an express server app.get('/test', noCache, (req, res) => {
res.cookie('mattia1', 'hello');
res.cookie('mattia2', 'world');
res.sendStatus(200);
}); Then on the app fetch({
url: 'http://localhost:3000/test'
}).then(res => {
console.log(res.headers);
}) On Android you get Only if you control the server the workaround is to not send 2 headers of the same type In this case with cookies you have to manually set the header with // doesnt work
// res.cookie('mattia1', 'hello');
// res.cookie('mattia2', 'world');
// works
res.set('Set-Cookie', 'mattia1=hello; Path=/, mattia2=world; Path=/'); |
For me it surprisingly work on the emulator, but not on a real device. The api's I make use of have cookies. There seems to be a problem in sending these cookies(which is part of the header) from a real device, but somehow works on an emulator. This happens for me on RN 0.56. |
This is still an issue on RN |
I am having this issue on |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. |
Fetch
is no longer returning all rows of the same-name response headers! This only just happened after recent upgrade.Environment
Environment:
OS: Windows 10
Node: 9.2.0
Yarn: 1.3.2
npm: 5.8.0
Watchman: Not Found
Xcode: N/A
Android Studio: Version 3.0.0.0 AI-171.4443003
Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: ^0.55.3 => 0.55.3
Steps to Reproduce
Server returns the following response
** react native code **
Expected Behavior
The test hdr (t1) must have both values but only the 2nd one is received. See the response from
postman
Actual Behavior
The text was updated successfully, but these errors were encountered: