Skip to content

feat: Sprint 4 — gzip/deflate body decompression + HAR timing fix#14

Merged
hxddh merged 1 commit into
mainfrom
feat/sprint-4
May 28, 2026
Merged

feat: Sprint 4 — gzip/deflate body decompression + HAR timing fix#14
hxddh merged 1 commit into
mainfrom
feat/sprint-4

Conversation

@hxddh

@hxddh hxddh commented May 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • Body decompression (decompress.go): new decompressBody(encoding, data) supporting gzip and deflate using the standard library only; output capped at 10 MiB
  • Transparent display (main.go): logRequest and logResponse now detect Content-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]
  • isPrintable refactored to extract isPrintableContentType(ct string) for the decompression path
  • HAR timing precision (har.go): Time and Timings.Wait now use float64(dur)/float64(time.Millisecond) for sub-millisecond resolution instead of dur.Milliseconds() (integer)
  • Fixed TestHAR_BasicCapture flakiness caused by the integer rounding

Test plan

  • TestDecompressBody_Gzip — round-trip gzip encode/decode
  • TestDecompressBody_Deflate — round-trip deflate encode/decode
  • TestDecompressBody_Identity / TestDecompressBody_Unknown — pass-through paths
  • TestLogResponse_GzipBodyDecoded — end-to-end: upstream returns gzip JSON, JSON log shows decoded body
  • All 38 tests pass with -race detector

https://claude.ai/code/session_01PPLEf2tHHFhw9rpW8dpdA3


Generated by Claude Code

…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
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@hxddh hxddh merged commit 187ba84 into main May 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants