added casper.currentResponse to access latest received response object
Showing
1 changed file
with
2 additions
and
0 deletions
... | @@ -111,6 +111,7 @@ var Casper = function Casper(options) { | ... | @@ -111,6 +111,7 @@ var Casper = function Casper(options) { |
111 | this.checker = null; | 111 | this.checker = null; |
112 | this.cli = phantom.casperArgs; | 112 | this.cli = phantom.casperArgs; |
113 | this.colorizer = this.getColorizer(); | 113 | this.colorizer = this.getColorizer(); |
114 | this.currentResponse = undefined; | ||
114 | this.currentUrl = 'about:blank'; | 115 | this.currentUrl = 'about:blank'; |
115 | this.currentHTTPStatus = 0; | 116 | this.currentHTTPStatus = 0; |
116 | this.defaultWaitTimeout = 5000; | 117 | this.defaultWaitTimeout = 5000; |
... | @@ -1653,6 +1654,7 @@ function createPage(casper) { | ... | @@ -1653,6 +1654,7 @@ function createPage(casper) { |
1653 | casper.resources.push(resource); | 1654 | casper.resources.push(resource); |
1654 | } | 1655 | } |
1655 | if (resource.url === casper.requestUrl && resource.stage === "end") { | 1656 | if (resource.url === casper.requestUrl && resource.stage === "end") { |
1657 | casper.currentResponse = resource; | ||
1656 | casper.currentHTTPStatus = resource.status; | 1658 | casper.currentHTTPStatus = resource.status; |
1657 | casper.emit('http.status.' + resource.status, resource); | 1659 | casper.emit('http.status.' + resource.status, resource); |
1658 | if (utils.isObject(casper.options.httpStatusHandlers) && | 1660 | if (utils.isObject(casper.options.httpStatusHandlers) && | ... | ... |
-
Please register or sign in to post a comment