Skip to content
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

Fetch Headers constructor should support string[][] parameter #17635

Closed
egorshulga opened this issue Jan 17, 2018 · 2 comments
Closed

Fetch Headers constructor should support string[][] parameter #17635

egorshulga opened this issue Jan 17, 2018 · 2 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@egorshulga
Copy link

egorshulga commented Jan 17, 2018

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
OS: Windows 10
Node: 8.9.4
Yarn: 1.3.2
npm: 5.6.0
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found

Packages: (wanted => installed)
react: ^16.2.0 => 16.2.0
react-native: 0.52.0 => 0.52.0

Steps to Reproduce

const headersArray = [
  ['Content-Type', 'application/json'],
  ['Authorization', 'Bearer token']
];
const headers = new Headers(headersArray);
console.log(headers.get('Content-Type'));

Expected Behavior

(In debug console):
application/json

Actual Behavior

(In debug console):
null

The issue occurred when I tried to share working code of fetch calls between a usual React project and a RN project. In React (in chrome) this code works perfectly, but RN cannot initialize Headers using string[][] parameter.

Here is an example of creating Headers from array of arrays.

@egorshulga
Copy link
Author

egorshulga commented Jan 17, 2018

I found that you use whatwg-fetch implementation of fetch.

The PR addressing this issue was merged and released in march 2017 (v2.0.3).
In packages.json: "whatwg-fetch": "^1.0.0".
Could this dependency been updated to the latest version?

I found that the update has been proposed in #12962. Could it be considered now?

@react-native-bot
Copy link
Collaborator

Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version?

I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer.

How to ContributeWhat to Expect from Maintainers

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon. labels Feb 24, 2018
@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 24, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Feb 24, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Feb 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

2 participants