blob: 5f87de58ba46a481434be288d1fd58e3896981d5 [file] [log] [blame]
(function() {
'use strict';
/**
* @ngdoc service
* @name xos.helpers.SetCSRFToken
* @description This factory is automatically loaded trough xos.helpers and will add an $http interceptor that will the CSRF-Token to your request headers
**/
angular
.module('xos.helpers')
.factory('SetCSRFToken', setCSRFToken);
function setCSRFToken($cookies) {
return {
request: function(request){
if(request.method !== 'GET'){
request.headers['X-CSRFToken'] = $cookies.get('xoscsrftoken');
}
return request;
}
};
}
})();