diff --git a/src/offscreen/handlers/notary_prove.ts b/src/offscreen/handlers/notary_prove.ts index cab74ffd..6bb637b1 100644 --- a/src/offscreen/handlers/notary_prove.ts +++ b/src/offscreen/handlers/notary_prove.ts @@ -196,12 +196,16 @@ async function calculateResponseSize( const contentLength = response.headers.get('content-length'); - if (!contentLength) { - throw new Error('no content length in response headers'); + let bodySize: number; + + if (contentLength) { + bodySize = parseInt(contentLength, 10); + } else { + console.debug('fallback to measuring response blob due to no content-length header'); + const blob = await response.blob(); + bodySize = blob.size; } - const bodySize = parseInt(contentLength, 10); - return headersSize + bodySize; }