From 78112aef95f1417117650c34a66dbb8cba8fe44b Mon Sep 17 00:00:00 2001 From: George Cheng Date: Fri, 29 May 2020 03:28:40 +0800 Subject: [PATCH] Fixing overwrite Blob/File type as Content-Type in browser. (#1773) Co-authored-by: Jay --- lib/adapters/xhr.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/adapters/xhr.js b/lib/adapters/xhr.js index 7d00129245..419ff71ad4 100644 --- a/lib/adapters/xhr.js +++ b/lib/adapters/xhr.js @@ -18,6 +18,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