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

Implemented response headers when using XMLHttpRequest #382

Closed
wants to merge 3 commits into from
Closed

Implemented response headers when using XMLHttpRequest #382

wants to merge 3 commits into from

Conversation

mikedriver
Copy link
Contributor

I think perhaps these were left out by mistake?

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@vjeux
Copy link
Contributor

vjeux commented Mar 28, 2015

Thanks! We never needed them so far so haven't implemented it.

I'll pull this out on monday (or before if I'm motivated)

…elimited by newlines rather than headers object
@mikedriver
Copy link
Contributor Author

Didn't notice that getAllResponseHeaders() should return a string. According to MDN it should also return null if no headers rather than a blank string. However I left it as a blank string instead because I noticed that the fetch library is doing xhr.getAllResponseHeaders().trim().split('\n') which would otherwise throw.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 7, 2015
int responseCode = (int)[((NSHTTPURLResponse *)response) statusCode];
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response;
NSDictionary *headerDict = [httpResponse allHeaderFields];
int responseCode = (int)[httpResponse statusCode];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be NSInteger, which is what the method actually returns . Not sure why we'd cast to an int (I appreciate that this was pre-existing, and not something you changed).

@crockeo
Copy link

crockeo commented Apr 9, 2015

@vjeux any update on merging this pull request?

@nicklockwood
Copy link
Contributor

Just looking into it now. Looks like it failed to land due to a unit test failure on internal CI. Probably a flaky test. I'll try re-submitting it.

@vjeux vjeux closed this in db330ac Apr 13, 2015
@frantic frantic mentioned this pull request Apr 14, 2015
vjeux pushed a commit to vjeux/react-native that referenced this pull request Apr 14, 2015
Summary:
I think perhaps these were left out by mistake?
Closes facebook#382
Github Author: Mike Driver <mikedriver@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
vjeux pushed a commit to vjeux/react-native that referenced this pull request Apr 15, 2015
Summary:
I think perhaps these were left out by mistake?
Closes facebook#382
Github Author: Mike Driver <mikedriver@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
joshzana added a commit to joshzana/react-native that referenced this pull request Apr 17, 2015
Used facebook#382 as inspiration
but modified to return null instead of undefined as per the spec at
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest

This unblocks use of Dropbox.js within a react-native app, as well
as any other libraries that make use of these methods in XHR usage
sahrens pushed a commit to sahrens/react-native that referenced this pull request Apr 22, 2015
Summary:
Used facebook#382 as inspiration
but modified to return null instead of undefined as per the spec at
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest

This unblocks use of Dropbox.js within a react-native app, as well
as any other libraries that make use of these methods in XHR usage.

Closes facebook#872
Closes facebook#892
Github Author: Josh Zana <joshzana@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
jfrolich pushed a commit to jfrolich/react-native that referenced this pull request Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants