SIGN IN SIGN UP

fix(replay): Fix network detail response body size being unknown for gzip-compressed responses (#5592)

* fix(replay): Derive response body size from peeked bytes when contentLength is unknown

For gzip-compressed responses, OkHttp strips the Content-Length header
during transparent decompression, so response.body.contentLength() returns
-1. This caused NetworkRequestData.responseBodySize to be unknown for
replay network details.

Add originalByteCount to NetworkBody, set it from the actual byte array
in NetworkBodyParser.fromBytes, and use it as a fallback in
NetworkDetailCaptureUtils when the passed bodySize is null or -1. This
piggybacks on the existing peekBody call with no additional I/O.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* changelog

* Changelog

* fix(replay): make NetworkBody 3-arg constructor package-private

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
R
Roman Zavarnitsyn committed
d500866b45ecf8012bdd05876ab70b538a7d6371
Parent: 4f4801e
Committed by GitHub <noreply@github.com> on 6/25/2026, 6:21:03 PM