aurelia / http-client

A simple, restful, message-based wrapper around XMLHttpRequest.
MIT License
62 stars 59 forks source link

Headers are not treated as case insensitive #152

Closed fragsalat closed 8 years ago

fragsalat commented 8 years ago

I'm submitting a bug report

Please tell us about your environment:

Current behavior: The current implementation of Headers isn't case-insensitive since the get(key: string) function just uses the argument as an key without any normalization. If the response header name was ETag and I try to get etag the function has(key: string) returns true because it's case insensitive, but get(key: string) returns false because it's case sensitive.

Expected/desired behavior: Regarding the RF2616 section 4.2 standard all message header names (general-, request-, response- and entity-headers) has to be handled as case insensitive.

EisenbergEffect commented 8 years ago

@fragsalat Any interest in making a PR to fix this?

fragsalat commented 8 years ago

@EisenbergEffect I'll do for sure :smile: But I wanted to have to many construstion sites and wait until https://github.com/aurelia/bundler/pull/144 is done first.

EisenbergEffect commented 8 years ago

Fantastic. Thank you!

heruan commented 8 years ago

This is pretty urgent: starting with the latest Chrome version (53.0.2785.143) all header names are lowercased and it breaks content-type recognition, thus breaking any Aurelia application which trusts http-client's responseType, since it accesses the header with the string Content-Type (see http-client/http-response-message.js#L81).