mirror of
https://github.com/tenrok/axios.git
synced 2026-06-14 18:42:33 +03:00
+10
-2
@@ -20,8 +20,16 @@ module.exports = {
|
||||
}
|
||||
if (utils.isObject(data) && !utils.isFile(data) && !utils.isBlob(data)) {
|
||||
// Set application/json if no Content-Type has been specified
|
||||
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
||||
headers['Content-Type'] = 'application/json;charset=utf-8';
|
||||
if (!utils.isUndefined(headers)) {
|
||||
utils.forEach(headers, function (val, key) {
|
||||
if (key.toLowerCase() === 'content-type') {
|
||||
headers['Content-Type'] = val;
|
||||
}
|
||||
});
|
||||
|
||||
if (utils.isUndefined(headers['Content-Type'])) {
|
||||
headers['Content-Type'] = 'application/json;charset=utf-8';
|
||||
}
|
||||
}
|
||||
return JSON.stringify(data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user