Skip to content

Commit ef8b1b0

Browse files
committed
Merge pull request #8 from PWKad/patch-1
Added custom AJAX headers to the AJAX POST. Sorry I took so long.
2 parents eec48dd + 4ad4cb0 commit ef8b1b0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

breeze.ajaxpost.js

+10
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
}
5959

6060
var ajaxFunction = ajaxAdapter.ajax;
61+
// Grab the custom headers set on the ajax adapter
62+
var customHeaders = ajaxAdapter.defaultSettings.headers;
6163
if (ajaxFunction) {
6264
ajaxAdapter.ajax = function (settings) {
6365
processSettings(settings);
@@ -95,6 +97,14 @@
9597
}
9698
}
9799
}
100+
// If there are custom headers,
101+
if (customHeaders) {
102+
settings.headers = { };
103+
// Create each one on the headers object
104+
$.each(customHeaders, function (index, item) {
105+
settings.headers[index]= item;
106+
});
107+
}
98108

99109
return settings;
100110
}

0 commit comments

Comments
 (0)