XHR: set lengthComputable
event property to false
if computing length failed
#617
Labels
good first issue
Good for newcomers
With #613 and #616, we've improved how the XHR interceptor calculates the
total
length of the request/response bodies. There are, however, cases when that length won't be calculated. For example, ifgetBodyByteLength()
function fails (e.g. in Node.js v18.19structuredClone()
throws on cloning UndiciResponse
instances; this has been fixed in later versions).Per specification, there are also cases when calculating the total length is impossible. I suspect that's a streaming scenario, when the server itself doesn't know the total length of the streamed response body.
In either of those cases, we should set the
lengthComputable
property on request/response events tofalse
. If the length is computable (default behavior right now), the property must be set totrue
(we may not be doing that right now).Materials
The text was updated successfully, but these errors were encountered: