Skip to content
This repository has been archived by the owner on Jun 19, 2020. It is now read-only.

Commit

Permalink
added casper.currentResponse to access latest received response object
Browse files Browse the repository at this point in the history
  • Loading branch information
n1k0 committed Jul 14, 2012
1 parent a12ef8f commit a34fbd9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/casper.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ var Casper = function Casper(options) {
this.checker = null;
this.cli = phantom.casperArgs;
this.colorizer = this.getColorizer();
this.currentResponse = undefined;
this.currentUrl = 'about:blank';
this.currentHTTPStatus = 0;
this.defaultWaitTimeout = 5000;
Expand Down Expand Up @@ -1657,6 +1658,7 @@ function createPage(casper) {
casper.resources.push(resource);
}
if (resource.url === casper.requestUrl && resource.stage === "end") {
casper.currentResponse = resource;
casper.currentHTTPStatus = resource.status;
casper.emit('http.status.' + resource.status, resource);
if (utils.isObject(casper.options.httpStatusHandlers) &&
Expand Down

0 comments on commit a34fbd9

Please sign in to comment.