Skip to content

Commit 085f568

Browse files
authored
fix(fetch): fix content length calculation for FormData payload; (#6524)
1 parent 59cd6b0 commit 085f568

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/adapters/fetch.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ const getBodyLength = async (body) => {
6969
}
7070

7171
if(utils.isSpecCompliantForm(body)) {
72-
return (await new Request(body).arrayBuffer()).byteLength;
72+
const _request = new Request(platform.origin, {
73+
method: 'POST',
74+
body,
75+
});
76+
return (await _request.arrayBuffer()).byteLength;
7377
}
7478

7579
if(utils.isArrayBufferView(body) || utils.isArrayBuffer(body)) {

0 commit comments

Comments
 (0)