Bug 36084: Fix is_ajax by setting X-Requested-With header
Some svc scripts (and controllers) are using using is_ajax to guess if it's an AJAX request. $.ajax is setting the (non standard) X-Requested-With header, but the low level JS 'fetch' does not. This patch set it in http-client. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
50f383de75
commit
6a9ff124a5
1 changed files with 2 additions and 1 deletions
|
@ -17,8 +17,9 @@ class Dialog {
|
|||
class HttpClient {
|
||||
constructor(options = {}) {
|
||||
this._baseURL = options.baseURL || "";
|
||||
this._headers = options.headers || {
|
||||
this._headers = options.headers || { // FIXME we actually need to merge the headers
|
||||
"Content-Type": "application/json;charset=utf-8",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
};
|
||||
this.csrf_token = $('meta[name="csrf-token"]').attr("content");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue