Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

headers missing on firefox #181

Closed
andrewrk opened this issue Feb 11, 2013 · 3 comments
Closed

headers missing on firefox #181

andrewrk opened this issue Feb 11, 2013 · 3 comments

Comments

@andrewrk
Copy link
Contributor

This causes resp.body to be null for json responses which is pretty catastrophic.

I've tried every version down to 0.9.8 and they all have the same issue. 0.9.8 actually throws an error instead of having a response which is incorrect because the status is 200 and the text is valid json.

@andrewrk
Copy link
Contributor Author

Related to this maybe? https://bugzilla.mozilla.org/show_bug.cgi?id=608735

@andrewrk
Copy link
Contributor Author

xhr.getAllResponseHeaders() is returning "" but xhr.getResponseHeader("Content-Type") returns application/json.

@tj tj closed this as completed in 5241606 Feb 11, 2013
tj added a commit that referenced this issue Feb 11, 2013
get content-type even if can't get other headers. fixes #181
@alinz
Copy link

alinz commented Jul 7, 2015

OK, it seems this bug returns when I use it with react-native 0.6 and above. What I found that xhr.getResponseHeader('content-type') starts to return null which isn't right.

Calling to this.xhr.getAllResponseHeaders() returns the correct sets of headers which also includes content-type.

So here's my humble solution:

var tryAnotherContentType = this.xhr.getResponseHeader('content-type');
if (tryAnotherContentType && tryAnotherContentType.length > 0) {
    this.header['content-type'] = tryAnotherContentType;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants