Is this a bug report?
Yes
Have you read the Bugs section of the Contributing to React Native Guide?
Yes
Environment
react-native -v: 0.46
Then, specify:
- Target Platform: iOS
- Development Operating System: macOS
- Build tools: Xcode
Description
In react-native@0.44, a flag withCredentials was introduced. In react-native@0.46, the behaviour was unintentionally changed by this commit: 047961f
withCredentials = true translates to HTTPShouldHandleCookies = YES in native code. After the commit that I linked above, the Cookie header gets set explicitly, which overrides any behaviour set by HTTPShouldHandleCookies.
Steps to Reproduce
Make a fetch request with the flag withCredentials: true.
Expected Behavior
The flag gets respected.
The cookie header only gets set explicitly if withCredentials = false
Actual Behavior
The flag gets overridden.
Reproducible Demo
Hard to make a demo, but the bug can be proven with the Apple documentation:
If your app sets the Cookie header on an NSMutableURLRequest object, then this method has no effect, and the cookie data you set in the header overrides all cookies from the cookie store.
Here you can see that HTTPShouldHandleCookies is being set based on the withCredentials flag.
Here you can see that the Cookie header is being set explicitly, which takes precedence over HTTPShouldHandleCookies.
Related issues
cc
@clozr
Is this a bug report?
Yes
Have you read the Bugs section of the Contributing to React Native Guide?
Yes
Environment
react-native -v: 0.46Then, specify:
Description
In
react-native@0.44, a flagwithCredentialswas introduced. Inreact-native@0.46, the behaviour was unintentionally changed by this commit: 047961fwithCredentials = truetranslates toHTTPShouldHandleCookies = YESin native code. After the commit that I linked above, theCookieheader gets set explicitly, which overrides any behaviour set byHTTPShouldHandleCookies.Steps to Reproduce
Make a
fetchrequest with the flagwithCredentials: true.Expected Behavior
The flag gets respected.
The cookie header only gets set explicitly if
withCredentials = falseActual Behavior
The flag gets overridden.
Reproducible Demo
Hard to make a demo, but the bug can be proven with the Apple documentation:
Here you can see that
HTTPShouldHandleCookiesis being set based on thewithCredentialsflag.Here you can see that the
Cookieheader is being set explicitly, which takes precedence overHTTPShouldHandleCookies.Related issues
cc
@clozr