javascript - How can i added default header for DELETE in angular js -
this working fine in angular js
$http.defaults.headers.post['x-csrftoken'] = $cookies['csrftoken']; $http.defaults.headers.put['x-csrftoken'] = $cookies['csrftoken']; $http.defaults.headers.patch['x-csrftoken'] = $cookies['csrftoken'];
but not working
$http.defaults.headers.delete['x-csrftoken'] = $cookies['csrftoken'];
per angular $http document, angular have 3 default headers configuration: common, put , post.
to add headers http method other post or put, add new object lowercased http method name key
$httpprovider.defaults.headers.get = { 'my-header' : 'value' }.
so in case,
$httpprovider.defaults.headers.delete = { 'x-csrftoken' : $cookies['csrftoken'] }.
Comments
Post a Comment