diff --git a/lib/XMLHttpRequest.js b/lib/XMLHttpRequest.js index bada957..01c198e 100644 --- a/lib/XMLHttpRequest.js +++ b/lib/XMLHttpRequest.js @@ -109,6 +109,7 @@ exports.XMLHttpRequest = function() { // Result & response this.responseText = ""; this.responseXML = ""; + this.responseURL = ""; this.status = null; this.statusText = null; @@ -169,6 +170,8 @@ exports.XMLHttpRequest = function() { "user": user || null, "password": password || null }; + + this.responseURL = url; setState(this.OPENED); }; @@ -408,7 +411,7 @@ exports.XMLHttpRequest = function() { // @TODO Prevent looped redirects if (response.statusCode === 301 || response.statusCode === 302 || response.statusCode === 303 || response.statusCode === 307) { // Change URL to the redirect location - settings.url = response.headers.location; + self.responseURL = settings.url = response.headers.location; var url = Url.parse(settings.url); // Set host var in case it's used later host = url.hostname;