2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-11 18:02:32 +03:00

Merging master

This commit is contained in:
Nick Uraltsev
2016-08-18 20:34:23 -07:00
5 changed files with 53 additions and 4 deletions
+28
View File
@@ -1,3 +1,5 @@
var cookies = require('../../lib/helpers/cookies');
describe('xsrf', function () {
beforeEach(function () {
jasmine.Ajax.install();
@@ -28,6 +30,32 @@ describe('xsrf', function () {
});
});
it('should not set xsrf header if xsrfCookieName is null', function (done) {
document.cookie = axios.defaults.xsrfCookieName + '=12345';
axios('/foo', {
xsrfCookieName: null
});
getAjaxRequest().then(function (request) {
expect(request.requestHeaders[axios.defaults.xsrfHeaderName]).toEqual(undefined);
done();
});
});
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';