2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-14 18:42:33 +03:00

The content type option is left to the developer (#4550)

* The content type option is left to the developer

If the browser recognizes the fault, it can protect the developer

Although I don't think Axios itself should interfere with developers' choices

This parameter is for compatibility with historical issues

* Update xhr.js

Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
Lawliet
2022-05-10 01:20:33 +08:00
committed by GitHub
parent 9f6ba5ee43
commit 9579bad1d3
+4 -2
View File
@@ -28,8 +28,10 @@ module.exports = function xhrAdapter(config) {
}
}
if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) {
delete requestHeaders['Content-Type']; // Let the browser set it
if (utils.isFormData(requestData) && utils.isStandardBrowserEnv() && !config.defineContentType ) {
// Let the browser set the content type should it not be set
delete requestHeaders['Content-Type'];
}
var request = new XMLHttpRequest();