Skip to content

Default value from property withCredentials in XMLHttpRequest should be false #21852

Closed
@fabio-paiva-sp

Description

@fabio-paiva-sp

Environment

System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Memory: 2.07 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
Yarn: 1.10.1 - ~/.nvm/versions/node/v8.12.0/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.0-alpha.8af6728 => 16.6.0-alpha.8af6728
react-native: 0.57.3 => 0.57.3
npmGlobalPackages:
react-native-cli: 2.0.1

Description

The default value from property withCredentials in XMLHttpRequest.js is true.
In Google Chrome Javascript engine it's false, in the most commons node JS libraries it's false or undefined. Why it's true in React Native?

I can't change it to false using Axios because the library is not checking the property correctly to set it to false. They assume the default is false.

// Axios library
// Add withCredentials to request if needed
    if (config.withCredentials) {
      request.withCredentials = true;
    }

It will never set it to false.

Reproducible Demo

axios({
  url: 'https://www.httpbin.org/anything',
  withCredentials: false,
}).then(console.log).catch(console.error);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.🌐NetworkingRelated to a networking API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions