-
Notifications
You must be signed in to change notification settings - Fork 24.9k
BREAKING: iOS: Support withCredentials flag in XHRs #12275
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
Conversation
Respect the withCredentials XMLHttpRequest flag for sending cookies with requests. This can reduce payload sizes where large cookies are set for domains. This should fix facebook#5347. This is a breaking change because it alters the default behavior of XHR. Prior to this change, XHR would send cookies by default. After this change, by default, XHR does not send cookies which is consistent with the default behavior of XHR on web for cross-site requests. Developers can restore the previous behavior by passing `true` for XHR's `withCredentials` argument.
Corresponding iOS PR: facebook#12275 Respect the withCredentials XMLHttpRequest flag for sending cookies with requests. This can reduce payload sizes where large cookies are set for domains. This should fix facebook#5347. This is a breaking change because it alters the default behavior of XHR. Prior to this change, XHR would send cookies by default. After this change, by default, XHR does not send cookies which is consistent with the default behavior of XHR on web for cross-site requests. Developers can restore the previous behavior by passing `true` for XHR's `withCredentials` argument. **Test plan (required)** Verified in a test app that XHR works properly when specifying `withCredentials` as `true`, `false`, and `undefined`. Also, my team uses this change in our app. Adam Comella Microsoft Corp.
Docs on withCredentials here: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials Looks good. Thanks for adding the "BREAKING" prefix. |
@mkonicek has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: Corresponding iOS PR: #12275 Respect the withCredentials XMLHttpRequest flag for sending cookies with requests. This can reduce payload sizes where large cookies are set for domains. This should fix #5347. This is a breaking change because it alters the default behavior of XHR. Prior to this change, XHR would send cookies by default. After this change, by default, XHR does not send cookies which is consistent with the default behavior of XHR on web for cross-site requests. Developers can restore the previous behavior by passing `true` for XHR's `withCredentials` argument. **Test plan (required)** Verified in a test app that XHR works properly when specifying `withCredentials` as `true`, `false`, and `undefined`. Also, my team uses this change in our app. Adam Comella Microsoft Corp. Closes #12276 Differential Revision: D4673646 Pulled By: ericvicenti fbshipit-source-id: 924c230c9df72071b3cf9151c3ac201905ac28a5
It seems like this conversion [1] does not work as expected. It always gives false, at least on the IOS simulator. This completely breaks cookies on IOS for 0.44. |
Very breaking indeed 😉 I didn't find mention to this change in the release notes even though it's a breaking change. Took me a while to find out what was going on. However, I think things are little more broken than intended. The
does not work. Instead the following is required:
Note the inclusion of |
Summary: Corresponding iOS PR: facebook#12275 Respect the withCredentials XMLHttpRequest flag for sending cookies with requests. This can reduce payload sizes where large cookies are set for domains. This should fix facebook#5347. This is a breaking change because it alters the default behavior of XHR. Prior to this change, XHR would send cookies by default. After this change, by default, XHR does not send cookies which is consistent with the default behavior of XHR on web for cross-site requests. Developers can restore the previous behavior by passing `true` for XHR's `withCredentials` argument. **Test plan (required)** Verified in a test app that XHR works properly when specifying `withCredentials` as `true`, `false`, and `undefined`. Also, my team uses this change in our app. Adam Comella Microsoft Corp. Closes facebook#12276 Differential Revision: D4673646 Pulled By: ericvicenti fbshipit-source-id: 924c230c9df72071b3cf9151c3ac201905ac28a5
I just tested this in React Native 0.44 and everything seems to be working. @matt-42 Are you setting @Benjamin-Dobell Things worked for me when using
If you can provide more details about what's broken for you, I can look into it. As far as I can tell, everything is working as expected. I'll see if I can get this added to the breaking change list so it doesn't surprise other people. |
Corresponding Android PR: #12276
Respect the withCredentials XMLHttpRequest flag for sending cookies with requests. This can reduce payload sizes where large cookies are set for domains.
This should fix #5347.
This is a breaking change because it alters the default behavior of XHR. Prior to this change, XHR would send cookies by default. After this change, by default, XHR does not send cookies which is consistent with the default behavior of XHR on web for cross-site requests. Developers can restore the previous behavior by passing
true
for XHR'swithCredentials
argument.Test plan (required)
Verified in a test app that XHR works properly when specifying
withCredentials
astrue
,false
, andundefined
. Also, my team uses this change in our app.Adam Comella
Microsoft Corp.