]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Use Ajax "headers" parameter
authorAlexander Moisseev <moiseev@mezonplus.ru>
Wed, 15 Aug 2018 11:58:33 +0000 (14:58 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Wed, 15 Aug 2018 11:58:33 +0000 (14:58 +0300)
to set custom headers

interface/js/app/rspamd.js

index 06d9a46f9c8d348e692f65e6dc495f23c05a4110..32a1ad297e8f195d8c40a801b544cc0ab5b30157 100644 (file)
@@ -195,15 +195,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
         var req_params = {
             jsonp: false,
             data: o.data,
-            beforeSend: function (xhr) {
-                xhr.setRequestHeader("Password", getPassword());
-
-                if (o.headers) {
-                    $.each(o.headers, function (hname, hvalue) {
-                        xhr.setRequestHeader(hname, hvalue);
-                    });
-                }
-            },
+            headers: $.extend({Password: getPassword()}, o.headers),
             url: neighbours_status[ind].url + req_url,
             success: function (json) {
                 neighbours_status[ind].checked = true;