Skip to content

Commit

Permalink
Fixing overwrite Blob/File type as Content-Type in browser. (axios#1773)
Browse files Browse the repository at this point in the history
Co-authored-by: Jay <jasonsaayman@gmail.com>
  • Loading branch information
Gerhut and jasonsaayman authored May 28, 2020
1 parent 4662c69 commit 1156add
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/adapters/xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1156add

Please sign in to comment.