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

Wrong header instance #416

Closed
jimmywarting opened this issue Oct 22, 2016 · 1 comment
Closed

Wrong header instance #416

jimmywarting opened this issue Oct 22, 2016 · 1 comment

Comments

@jimmywarting
Copy link

Found this minor issue while testing

Chrome

h = new Headers({'x-foo': 'x-bar'})
res = new Response('x', {headers: h})

console.log(h === res.headers) // false

Polyfill

h = new Headers({'x-foo': 'x-bar'})
res = new Response('x', {headers: h})

console.log(h === res.headers) // true

Maybe it should be simplified from:

this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)

To just:

this.headers = new Headers(options.headers || {})
@jimmywarting
Copy link
Author

test:

  // #416
  test('creates a new instanceof headers when constructing', function() {
    var h = new Headers({'x-foo': 'x-bar'})
    var res = new Response('x', {headers: h})

    assert.equal(h === res.headers, false)
  })

@mislav mislav closed this as completed in 80105ae Nov 11, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant