Skip to content

Commit

Permalink
get content-type even if can't get other headers. fixes #181
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrk committed Feb 11, 2013
1 parent 51941d1 commit 5241606
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/client.js
Original file line number Diff line number Diff line change
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 5241606

Please sign in to comment.