Skip to content

Commit

Permalink
Merge pull request #182 from superjoe30/patch-1
Browse files Browse the repository at this point in the history
get content-type even if can't get other headers. fixes #181
  • Loading branch information
tj committed Feb 11, 2013
2 parents 51941d1 + 5241606 commit 3e8a8c3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/client.js
Expand Up @@ -270,6 +270,10 @@ function Response(xhr, options) {
this.text = xhr.responseText;
this.setStatusProperties(xhr.status);
this.header = parseHeader(xhr.getAllResponseHeaders());
// getAllResponseHeaders sometimes falsely returns "" for CORS requests, but
// getResponseHeader still works. so we get content-type even if getting
// other headers fails.
this.header['content-type'] = xhr.getResponseHeader('content-type');
this.setHeaderProperties(this.header);
this.body = this.parseBody(this.text);
}
Expand Down

0 comments on commit 3e8a8c3

Please sign in to comment.