Skip to content

Commit

Permalink
Add responseURL property for XMLHttpRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
realaboo committed Dec 26, 2015
1 parent 226b36c commit 6f6fc33
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Libraries/Fetch/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ var self = {};
}
this._initBody(body)
}

Request.prototype.clone = function() {
return new Request(this)
}
Expand Down Expand Up @@ -324,7 +324,7 @@ var self = {};
this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)
this.url = options.url || ''
}

Response.prototype.clone = function() {
return new Response(this._bodyInit, {
status: this.status,
Expand Down Expand Up @@ -352,7 +352,7 @@ var self = {};
var xhr = new XMLHttpRequest()

function responseURL() {
if ('responseURL' in xhr) {
if ('responseURL' in xhr && xhr.responseURL) {
return xhr.responseURL
}

Expand Down
7 changes: 3 additions & 4 deletions Libraries/Network/XMLHttpRequestBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class XMLHttpRequestBase {
responseHeaders: ?Object;
responseText: ?string;
status: number;
responseURL: ?string;

upload: ?{
onprogress?: (event: Object) => void;
Expand Down Expand Up @@ -69,7 +70,7 @@ class XMLHttpRequestBase {
this.responseHeaders = undefined;
this.responseText = '';
this.status = 0;
delete this.responseURL;
this.responseURL = null;

this._requestId = null;

Expand Down Expand Up @@ -116,9 +117,7 @@ class XMLHttpRequestBase {
this.status = status;
this.setResponseHeaders(responseHeaders);
this.setReadyState(this.HEADERS_RECEIVED);
if (responseURL) {
this.responseURL = responseURL;
}
this.responseURL = responseURL || null;
}
}

Expand Down

0 comments on commit 6f6fc33

Please sign in to comment.