From: Matthias Schmidt Date: Wed, 23 Sep 2015 15:52:52 +0000 (+0200) Subject: Add contentType option for AjaxRequest X-Git-Tag: 3.0.0_Beta_1~2123 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2fb800af277069c7993a6b2a69c02ba0dddbc4fa;p=GitHub%2FWoltLab%2FWCF.git Add contentType option for AjaxRequest --- diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ajax/Request.js b/wcfsetup/install/files/js/WoltLab/WCF/Ajax/Request.js index 675c8cfd32..f329ac1db2 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ajax/Request.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ajax/Request.js @@ -35,6 +35,7 @@ define(['Core', 'Language', 'Dom/ChangeListener', 'Dom/Util', 'Ui/Dialog', 'Wolt this._options = Core.extend({ // request data data: {}, + contentType: 'application/x-www-form-urlencoded; charset=UTF-8', responseType: 'application/json', type: 'POST', url: '', @@ -96,7 +97,9 @@ define(['Core', 'Language', 'Dom/ChangeListener', 'Dom/Util', 'Ui/Dialog', 'Wolt this._xhr = new XMLHttpRequest(); this._xhr.open(this._options.type, this._options.url, true); - this._xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); + if (this._options.contentType) { + this._xhr.setRequestHeader('Content-Type', this._options.contentType); + } this._xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); var self = this;