Updating xhr adapter to inherit withCredentials flag from the config #1441
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change is necessary to allow updating withCredentials XHR flag in React Native environment where for historical reasons unlike on the web the default value is
true
.Link to the web spec: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials
See the default being set to
true
in React Native here: https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/XMLHttpRequest.js#L133Prior this change we would only update withCredentials XHR flag if the config was set to
true
. This was preventing overriding the flag withfalse
in React Native apps. Now we just pass through the config value as long as it is specified. This does not affect the default behaviour on web or React Native as if the flag wasn't set in the config we won't set it on XHR request either.This also fixes #1101