FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Ignore the case when getting a response header · NativeScript/NativeScript@37e6e3d · GitHub

Commit 37e6e3d

Browse files
committed
Ignore the case when getting a response header
According to the RFC: https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 "Field names are case-insensitive". For instance, Google Cloud Endpoints use "content-type" in the response.
1 parent 8fd0476 commit 37e6e3d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎tns-core-modules/xhr/xhr.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,13 @@ export class XMLHttpRequest {
194194
public getResponseHeader(header: string): string {
195195
if (types.isString(header) && this._readyState > 1
196196
&& this._headers
197-
&& this._headers[header]
198197
&& !this._errorFlag
199198
) {
200-
return this._headers[header];
199+
for (var i in this._headers) {
200+
if (i.toLowerCase() === header.toLowerCase()) {
201+
return this._headers[i];
202+
}
203+
}
201204
}
202205

203206
return null;

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL