zombie
zombie copied to clipboard
zombie.js isn't sending the referer header
Referer Header
Unfortunately zombie.js isn't sending the referer header with its ajax requests which makes Django's csrf check fail through https connections. Hard-coding the referer as 'https:/mywebsite.com', will get pass Django's check; however its correct value should be the full location (window.location.href) given by the ajax request that is being made from.
Hello, you can set it manually like this
browser.on('request', function (req) {
if (browser.location) {
req.headers.set("Referer", browser.location.href);
}
});
I needed to do this same workaround for when I was testing JSON-P style AJAX requests, also. Worked just fine.
I think it should be done by default, as browsers have the same behavior.