mirror of
https://github.com/wukko/cobalt.git
synced 2025-04-29 22:14:26 +02:00
web/fetch: use estimated-content-length if content-length is unavailable
This commit is contained in:
parent
37a71837a7
commit
d1bb1764df
@ -31,8 +31,11 @@ const fetchFile = async (url: string) => {
|
|||||||
return error("file response wasn't ok");
|
return error("file response wasn't ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
const contentType = response.headers.get('Content-Type') || 'application/octet-stream';
|
const contentType = response.headers.get('Content-Type')
|
||||||
const contentLength = response.headers.get('Content-Length');
|
|| 'application/octet-stream';
|
||||||
|
|
||||||
|
const contentLength = response.headers.get('Content-Length')
|
||||||
|
|| response.headers.get('Estimated-Content-Length');
|
||||||
|
|
||||||
const totalBytes = contentLength ? parseInt(contentLength, 10) : null;
|
const totalBytes = contentLength ? parseInt(contentLength, 10) : null;
|
||||||
const reader = response.body?.getReader();
|
const reader = response.body?.getReader();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user