From 4861df4b66e047ee9a936215a0bcdb4e232a706e Mon Sep 17 00:00:00 2001 From: Stoneman1 Date: Tue, 21 Jun 2016 18:05:56 +0300 Subject: [PATCH] Added file type mappings to accept headers. --- src/loader/Loader.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/loader/Loader.js b/src/loader/Loader.js index d0bf7e02e..e022cd25c 100644 --- a/src/loader/Loader.js +++ b/src/loader/Loader.js @@ -102,8 +102,18 @@ Phaser.Loader = function (game) { */ this.path = ''; + /** + * @property {object} Headers - Maps file types to accept headers. + * @default + */ + + this.headers = { + json: "application/json", + xml: "application/xml" + }; + /** - * This event is dispatched when the loading process starts: before the first file has been requested, + * This event is dispatched when the loading process starts: before the first file has been requested, * but after all the initial packs have been loaded. * * @property {Phaser.Signal} onLoadStart @@ -2317,6 +2327,7 @@ Phaser.Loader.prototype = { var xhr = new XMLHttpRequest(); xhr.open("GET", url, true); xhr.responseType = type; + if (this.headers[file.type]) { xhr.setRequestHeader("Accept", this.headers[file.type]); } onerror = onerror || this.fileError;