2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-20 20:00:40 +03:00

Fixed isFormData predicate; (#4413)

Added support for automatic object serialization to FormData if `Content-Type` is `multipart/form-data`;
Added support for FormData to be overloaded using `config.env.FormData` option;
Added support for FormData in node.js environment through `form-data` package;
This commit is contained in:
Dmitriy Mozgovoy
2022-02-02 13:48:44 +02:00
committed by GitHub
parent cc86c6c49f
commit 73e3bdb883
6 changed files with 40 additions and 15 deletions
+3 -1
View File
@@ -87,7 +87,9 @@ module.exports = function httpAdapter(config) {
headers['User-Agent'] = 'axios/' + VERSION;
}
if (data && !utils.isStream(data)) {
if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
Object.assign(headers, data.getHeaders());
} else if (data && !utils.isStream(data)) {
if (Buffer.isBuffer(data)) {
// Nothing to do...
} else if (utils.isArrayBuffer(data)) {