Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
set request tokens on request made using fetch
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Apr 3, 2019
commit 1d6cd7c4681d9e5821fbeb973358e30cef0340db
10 changes: 10 additions & 0 deletions core/js/oc-requesttoken.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,13 @@ $(document).on('ajaxSend',function(elm, xhr, settings) {
xhr.setRequestHeader('OCS-APIREQUEST', 'true');
}
});

(function () {
var originalFetch = window.fetch;
window.fetch = function(input, init) {
init = init || {};
init.headers = init.headers || {};
init.headers.requesttoken = oc_requesttoken;
return originalFetch(input, init);
}
})();