Skip to content

[General] fixes fetch module credentials - #24726

Closed
zhongwuzw wants to merge 1 commit into
react:masterfrom
zhongwuzw:fix_fetch_credentials
Closed

[General] fixes fetch module credentials#24726
zhongwuzw wants to merge 1 commit into
react:masterfrom
zhongwuzw:fix_fetch_credentials

Conversation

@zhongwuzw

Copy link
Copy Markdown
Contributor

Summary

In #14063, we decided to set withCredential to true by default, now if we use XMLHttpRequest, it works, but for fetch polyfill, withCredential is be set to false because we use Request's credentials https://github.com/facebook/react-native/blob/master/Libraries/vendor/core/whatwg-fetch.js#L515.

So we have inconsistency about withCrendential. My fix is to change Requestcredentials default value to same-origin, it reasonable because refer to MDN, the default value is same-origin.

cc. @cpojer.

Changelog

[General] [Fixed] - fixes fetch module credentials

Test Plan

For any request from either XMLHttpRequest or fetch, we set withCredential to true by default.

@facebook-github-botfacebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 7, 2019
@react-native-botreact-native-bot added 🌐Networking Related to a networking API. Bug labels May 7, 2019
@zhigang1992

Copy link
Copy Markdown
Contributor

Seems like this file is getting revert back to the npm version. #24418

@cpojer

Copy link
Copy Markdown
Contributor

I don't think we can change this as we are getting rid of the fetch fork. Maybe we can change something in fetch to do the right thing by default for RN?

@cpojercpojer closed this May 7, 2019
@zhongwuzw

Copy link
Copy Markdown
ContributorAuthor

@cpojer Please see #24418 (comment) or #14063. We changed some behavior because react-native is not for web.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BugCLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.🌐NetworkingRelated to a networking API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@zhongwuzw@zhigang1992@cpojer@facebook-github-bot@react-native-bot