mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 15:11:10 +00:00
Fixes web cliebt API calls not including correct HTTP request headers
This commit is contained in:
1 parent
a537dd78c5
commit
64e180f7e4
1 file changed
+8
-1
@@ -26,7 +26,8 @@ async function callApiGetAsync(url) {
|
|||||||
// call the API
|
// call the API
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json',
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (response.redirected) // if a redirect is requested, perform it
|
if (response.redirected) // if a redirect is requested, perform it
|
||||||
@@ -65,6 +66,8 @@ async function callApiPostAsync(url, data, options = {}) {
|
|||||||
// prepare headers
|
// prepare headers
|
||||||
const headers = {
|
const headers = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
...finalOptions.headers
|
...finalOptions.headers
|
||||||
};
|
};
|
||||||
// add anti-forgery token if enabled
|
// add anti-forgery token if enabled
|
||||||
@@ -118,6 +121,8 @@ async function callApiPutAsync(url, data, options = {}) {
|
|||||||
// prepare headers
|
// prepare headers
|
||||||
const headers = {
|
const headers = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
...finalOptions.headers
|
...finalOptions.headers
|
||||||
};
|
};
|
||||||
// add anti-forgery token if enabled
|
// add anti-forgery token if enabled
|
||||||
@@ -170,6 +175,8 @@ async function callApiDeleteAsync(url, options = {}) {
|
|||||||
// prepare headers
|
// prepare headers
|
||||||
const headers = {
|
const headers = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
...finalOptions.headers
|
...finalOptions.headers
|
||||||
};
|
};
|
||||||
// add anti-forgery token if enabled
|
// add anti-forgery token if enabled
|
||||||
|
|||||||
Reference in new issue
Block a user