From 2fb800af277069c7993a6b2a69c02ba0dddbc4fa Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Wed, 23 Sep 2015 17:52:52 +0200 Subject: [PATCH] Add contentType option for AjaxRequest --- wcfsetup/install/files/js/WoltLab/WCF/Ajax/Request.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; -- 2.20.1