feat: Sprint 4 — gzip/deflate body decompression + HAR timing fix#14
Merged
Conversation
…timing
- decompress.go: decompressBody(encoding, data) supporting gzip and deflate
(standard library only, 10 MiB decompressed cap)
- main.go: extract isPrintableContentType(ct) from isPrintable; logRequest and
logResponse now peek the full body when Content-Encoding is set, decompress,
and display the decoded text — compressed API responses are no longer shown
as "[binary data, N+ bytes]"
- har.go: use float64(dur)/float64(time.Millisecond) for sub-millisecond
precision instead of the integer dur.Milliseconds()
- main_test.go: TestDecompressBody_{Gzip,Deflate,Identity,Unknown},
TestLogResponse_GzipBodyDecoded; fix TestHAR_BasicCapture flakiness
https://claude.ai/code/session_01PPLEf2tHHFhw9rpW8dpdA3
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
decompress.go): newdecompressBody(encoding, data)supportinggzipanddeflateusing the standard library only; output capped at 10 MiBmain.go):logRequestandlogResponsenow detectContent-Encoding, peek the full body (up to 1 MB), decompress, and show the decoded text when the content-type is human-readable — compressed API responses are no longer shown as[binary data, N+ bytes]isPrintablerefactored to extractisPrintableContentType(ct string)for the decompression pathhar.go):TimeandTimings.Waitnow usefloat64(dur)/float64(time.Millisecond)for sub-millisecond resolution instead ofdur.Milliseconds()(integer)TestHAR_BasicCaptureflakiness caused by the integer roundingTest plan
TestDecompressBody_Gzip— round-trip gzip encode/decodeTestDecompressBody_Deflate— round-trip deflate encode/decodeTestDecompressBody_Identity/TestDecompressBody_Unknown— pass-through pathsTestLogResponse_GzipBodyDecoded— end-to-end: upstream returns gzip JSON, JSON log shows decoded body-racedetectorhttps://claude.ai/code/session_01PPLEf2tHHFhw9rpW8dpdA3
Generated by Claude Code