2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-15 11:59:42 +03:00

fix(http): add support for File objects as payload in http adapter (#6588) (#6605)

Co-authored-by: Hendrik Appel <happel@europe.altair.com>
Co-authored-by: Jay <jasonsaayman@gmail.com>
Co-authored-by: Dmitriy Mozgovoy <robotshara@gmail.com>
This commit is contained in:
Henco Appel
2024-10-13 18:43:40 +01:00
committed by GitHub
parent 17cab9c296
commit 6841d8d18d
+1 -1
View File
@@ -314,7 +314,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
} catch (e) {
}
}
} else if (utils.isBlob(data)) {
} else if (utils.isBlob(data) || utils.isFile(data)) {
data.size && headers.setContentType(data.type || 'application/octet-stream');
headers.setContentLength(data.size || 0);
data = stream.Readable.from(readBlob(data));