LCOV - code coverage report
Current view: top level - dashql-app/src/utils - content_length.ts Coverage Total Hit
Test: DashQL 915828b Lines: 100.0 % 7 7
Test Date: 2026-11-06 19:30:32

            Line data    Source code
       1              : /// The number of bytes the body of a response will yield, or 0 if the server does not tell.
       2              : ///
       3              : /// Content-Length counts the bytes on the wire. For a Content-Encoded response, such as the Brotli-compressed
       4              : /// WebAssembly of the pages build, the body stream yields the decoded bytes, which are more. Progress would run past 100%
       5              : /// if the two were compared.
       6            1 : export function decodedContentLength(response: Response): number {
       7            1 :     const encoding = response.headers.get('content-encoding');
       8            1 :     if (encoding != null && encoding.trim().toLowerCase() !== 'identity') {
       9            1 :         return 0;
      10              :     }
      11            1 :     const length = parseInt(response.headers.get('content-length') ?? '', 10);
      12            1 :     return Number.isFinite(length) && length > 0 ? length : 0;
      13            1 : }
        

Generated by: LCOV version 2.0-1