Enable CSRF token handling for PUT and PATCH reqs
Currently, passing of CSRF token embedded in html enabled only for
POST AJAX requests. But in some cases dashboard uses PUT and PATCH
requests, e.g. at Admin-Compute-Flavors-Update Metadata modal window.
Proposed patch enables passing of token also for such requests
Related-bug:
$route
) {
- $http.defaults.headers.post['X-CSRFToken'] = $cookies.csrftoken ||
+ var csrftoken = $cookies.csrftoken ||
$('input[name="csrfmiddlewaretoken"]').val();
+ $http.defaults.headers.post['X-CSRFToken'] = csrftoken;
+ $http.defaults.headers.put['X-CSRFToken'] = csrftoken;
+ $http.defaults.headers.patch['X-CSRFToken'] = csrftoken;
// expose the legacy utils module
horizon.utils = hzUtils;
