Skip to content

Commit

Permalink
Fixes issue with binary response bodies being empty in react native (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisradek committed May 9, 2017
1 parent 75343e9 commit 2c1b94e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/next-release/bugfix-ReactNative-1c146c4d.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "bugfix",
"category": "ReactNative",
"description": "Fixes issue where binary responses were empty in iOS (e.g. s3.getObject)"
}
2 changes: 1 addition & 1 deletion lib/http/xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ AWS.XHRClient = AWS.util.inherit({
} catch (e) { return; }

if (this.readyState >= this.HEADERS_RECEIVED && !headersEmitted) {
try { xhr.responseType = 'arraybuffer'; } catch (e) {}
emitter.statusCode = xhr.status;
emitter.headers = self.parseHeaders(xhr.getAllResponseHeaders());
emitter.emit(
Expand Down Expand Up @@ -75,6 +74,7 @@ AWS.XHRClient = AWS.util.inherit({
if (httpOptions.xhrWithCredentials) {
xhr.withCredentials = true;
}
try { xhr.responseType = 'arraybuffer'; } catch (e) {}

try {
if (httpRequest.body) {
Expand Down
18 changes: 18 additions & 0 deletions test/browser.spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2c1b94e

Please sign in to comment.