2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-15 11:59:42 +03:00

Added test to ensure that XHR adapter does not read cookies if xsrfCookieName is null

This commit is contained in:
Marco Pracucci
2016-08-11 10:47:53 +02:00
parent 85b9015890
commit e861a6cf75
+15
View File
@@ -1,3 +1,5 @@
var cookies = require('../../lib/helpers/cookies');
describe('xsrf', function () {
beforeEach(function () {
jasmine.Ajax.install();
@@ -41,6 +43,19 @@ describe('xsrf', function () {
});
});
it('should not read cookies at all if xsrfCookieName is null', function (done) {
spyOn(cookies, "read");
axios('/foo', {
xsrfCookieName: null
});
getAjaxRequest().then(function (request) {
expect(cookies.read).not.toHaveBeenCalled();
done();
});
});
it('should not set xsrf header for cross origin', function (done) {
document.cookie = axios.defaults.xsrfCookieName + '=12345';