diff options
Diffstat (limited to 'deps/undici/src/lib/fetch/body.js')
-rw-r--r-- | deps/undici/src/lib/fetch/body.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/deps/undici/src/lib/fetch/body.js b/deps/undici/src/lib/fetch/body.js index c291afa936..db450ee6bd 100644 --- a/deps/undici/src/lib/fetch/body.js +++ b/deps/undici/src/lib/fetch/body.js @@ -123,6 +123,7 @@ function extractBody (object, keepalive = false) { const blobParts = [] const rn = new Uint8Array([13, 10]) // '\r\n' length = 0 + let hasUnknownSizeValue = false for (const [name, value] of object) { if (typeof value === 'string') { @@ -138,13 +139,20 @@ function extractBody (object, keepalive = false) { value.type || 'application/octet-stream' }\r\n\r\n`) blobParts.push(chunk, value, rn) - length += chunk.byteLength + value.size + rn.byteLength + if (typeof value.size === 'number') { + length += chunk.byteLength + value.size + rn.byteLength + } else { + hasUnknownSizeValue = true + } } } const chunk = enc.encode(`--${boundary}--`) blobParts.push(chunk) length += chunk.byteLength + if (hasUnknownSizeValue) { + length = null + } // Set source to object. source = object |