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

fix(fetch): fix content length calculation for FormData payload; (#6524)

This commit is contained in:
Jacques Germishuys
2024-08-25 18:38:10 +01:00
committed by GitHub
parent 59cd6b0dec
commit 085f56861a
+5 -1
View File
@@ -69,7 +69,11 @@ const getBodyLength = async (body) => {
}
if(utils.isSpecCompliantForm(body)) {
return (await new Request(body).arrayBuffer()).byteLength;
const _request = new Request(platform.origin, {
method: 'POST',
body,
});
return (await _request.arrayBuffer()).byteLength;
}
if(utils.isArrayBufferView(body) || utils.isArrayBuffer(body)) {