zombie
zombie copied to clipboard
Retrieve Server HTTP Headers
The documentation describes ways to set Cookie and Referrer values, but how can we retrieve the values set by the server?
var Browser = require('zombie'),
assert = require('chai').assert;
var browser;
suite('Server Response Test', function() {
setup(function() {
browser = new Browser;
});
test('validate server response', function(done) {
var link = 'http://localhost:3000/';
browser.visit(link, function() {
browser.clickLink('.googleLink',
function() {
assert(browser.field('referrer').value === link);
done();
});
});
});
});
I'm using Mocha here, but I'm not sure how to get the HTTP server headers. This example is contrived, returning null for browser.field('referrer').value. Ideally, I'd like to get HTTP Server, "Referer", Last-Modified, Connection, Cache-Control, etc.
Thanks!
Have a look at resources: http://zombie.js.org/#resources
I get the same problem... it's always null. still repro on the latest version
@dreambo8563 The fix is provided by YoussefKababe's change. I don't know if or when it will be merged into master, but making his change locally seems to fix the issue for me.
Experiencing this bug. Waiting for #947 to be pulled.
In the mean time, using browser.resources[0].request.headers._headers[0][1] to get the referer field