From 1b33e7066e74afd7708ed2071e0769869434cece Mon Sep 17 00:00:00 2001 From: George Cheng Date: Fri, 29 Jun 2018 18:34:51 +0800 Subject: [PATCH] Fixing overwrite Blob/File type as Content-Type in browser. --- lib/adapters/xhr.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/adapters/xhr.js b/lib/adapters/xhr.js index 8c98d114b6..7c6dac21a6 100644 --- a/lib/adapters/xhr.js +++ b/lib/adapters/xhr.js @@ -16,6 +16,13 @@ module.exports = function xhrAdapter(config) { delete requestHeaders['Content-Type']; // Let the browser set it } + if ( + (utils.isBlob(requestData) || utils.isFile(requestData)) && + requestData.type + ) { + delete requestHeaders['Content-Type']; // Let the browser set it + } + var request = new XMLHttpRequest(); // HTTP basic authentication