Skip to content

Commit

Permalink
fix(fetch): fix content length calculation for FormData payload; (#6524)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesg authored Aug 25, 2024
1 parent 59cd6b0 commit 085f568
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/adapters/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 085f568

Please sign in to comment.