Created
July 27, 2012 13:45
-
-
Save davisford/3188122 to your computer and use it in GitHub Desktop.
Phantom/Casper request/response JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// how to dump headers and what they look like | |
casper.on('resource.requested', function (request) { | |
console.log('Request ' + JSON.stringify(request, undefined, 4)); | |
}); | |
casper.on('resource.received', function (response) { | |
console.log('Receive ' + JSON.stringify(response, undefined, 4)); | |
}); | |
// request | |
{ | |
"headers": [ | |
{ | |
"name": "User-Agent", | |
"value": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0" | |
}, | |
{ | |
"name": "Accept", | |
"value": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" | |
} | |
], | |
"id": 1, | |
"method": "GET", | |
"time": "2012-07-26T15:23:32.932Z", | |
"url": "https://somewhere.com" | |
} | |
// response | |
{ | |
"bodySize": 8528, | |
"contentType": "text/html;charset=UTF-8", | |
"headers": [ | |
{ | |
"name": "Date", | |
"value": "Thu, 26 Jul 2012 15:23:34 GMT" | |
}, | |
{ | |
"name": "Server", | |
"value": "IBM_HTTP_Server" | |
}, | |
{ | |
"name": "Cache-Control", | |
"value": "no-cache" | |
}, | |
{ | |
"name": "Expires", | |
"value": "Mon, 1 Jan 1990 00:00:00 GMT" | |
}, | |
{ | |
"name": "Pragma", | |
"value": "no-cache" | |
}, | |
{ | |
"name": "Set-Cookie", | |
"value": "foobar; Path=/; Domain=.somewhere.com" | |
}, | |
{ | |
"name": "Keep-Alive", | |
"value": "timeout=15, max=100" | |
}, | |
{ | |
"name": "Connection", | |
"value": "Keep-Alive" | |
}, | |
{ | |
"name": "Transfer-Encoding", | |
"value": "chunked" | |
}, | |
{ | |
"name": "Content-Type", | |
"value": "text/html;charset=UTF-8" | |
}, | |
{ | |
"name": "Content-Language", | |
"value": "en-US" | |
} | |
], | |
"id": 1, | |
"redirectURL": null, | |
"stage": "start", | |
"status": 200, | |
"statusText": "OK", | |
"time": "2012-07-26T15:23:33.438Z", | |
"url": "https://somewhere.com" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment