Skip to content

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

@egorshulga

Description

@egorshulga

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions