PolymerElements / iron-ajax

Easily make ajax requests
https://www.webcomponents.org/element/PolymerElements/iron-ajax
127 stars 113 forks source link

Headers get sent with the wrong name #244

Open jordyvandomselaar opened 7 years ago

jordyvandomselaar commented 7 years ago

Description

When I set a header like so: this.$.authAjax.headers = {"Authorization" : "Bearer "+this.accessToken}; it doesn't send it correctly

Expected outcome

iron-ajax adds a header called Authorization

Actual outcome

iron-ajax adds a header called authorization

The problem is that my server is case-sensitive.

Steps to reproduce

  1. use iron-ajax
  2. add headers
  3. generateRequest()
  4. profit.

Browsers Affected

bennypowers commented 7 years ago

https://github.com/PolymerElements/iron-ajax/blob/97685a88f7727249fb63667969238faa0e704198/iron-ajax.html#L401

toString() returns lowercase. see http://stackoverflow.com/questions/19751886/does-tostring16-always-return-lowercase

jordyvandomselaar commented 7 years ago

I figured that part out, but this shouldn't be happening right? I mean tostring() does that, I know, but shouldn't it be done differently then?

jordyvandomselaar commented 7 years ago

Update! The problem is here: https://github.com/PolymerElements/iron-ajax/blob/master/iron-request.html#L259

stramel commented 7 years ago

Good discussions https://github.com/whatwg/xhr/issues/34