From: Tim Düsterhus Date: Thu, 13 Apr 2023 14:01:52 +0000 (+0200) Subject: Set explicit `Accept` header in Ajax/Request.ts X-Git-Tag: 6.0.0_Alpha_1~260^2~9 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=86639f580549d3549660f1a3e3e64281e1c14152;p=GitHub%2FWoltLab%2FWCF.git Set explicit `Accept` header in Ajax/Request.ts --- diff --git a/ts/WoltLabSuite/Core/Ajax/Request.ts b/ts/WoltLabSuite/Core/Ajax/Request.ts index d5e09235da..4a5021951f 100644 --- a/ts/WoltLabSuite/Core/Ajax/Request.ts +++ b/ts/WoltLabSuite/Core/Ajax/Request.ts @@ -126,6 +126,9 @@ class AjaxRequest { if (this._options.withCredentials || this._options.includeRequestedWith) { this._xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); } + if (this._options.responseType) { + this._xhr.setRequestHeader("Accept", this._options.responseType); + } if (this._options.withCredentials) { this._xhr.withCredentials = true; } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Request.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Request.js index d44b81d359..38209795e8 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Request.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Request.js @@ -103,6 +103,9 @@ define(["require", "exports", "tslib", "./Status", "../Core", "../Dom/Change/Lis if (this._options.withCredentials || this._options.includeRequestedWith) { this._xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); } + if (this._options.responseType) { + this._xhr.setRequestHeader("Accept", this._options.responseType); + } if (this._options.withCredentials) { this._xhr.withCredentials = true; }