Problem
httpResponse.writeTo replaces res.Body with a rendered representation (hex dump, cropped text, or a placeholder) but never updates res.ContentLength. It then calls res.Write(w), which is an HTTP wire-format serializer and copies exactly ContentLength bytes. Any rendered form longer than the original body gets cut off.
Reproduction
a) --silent mode — placeholder truncated to 4 characters (body is boom, Content-Length: 4):
$ http-assert -s --assert-ok http://127.0.0.1:8791/500
…
HTTP/1.1 500 Internal Server Error
Content-Length: 4
<< ← expected " << Payload is omitted >>"
b) Binary body (8 bytes) — hex dump reduced to a single field:
$ http-assert -v --assert-body-eq 'x' http://127.0.0.1:8791/binary
…
Content-Length: 8
00000000 ← the entire hex dump
c) gzip'd body (40 bytes) — hex dump cut mid-line:
HTTP/1.1 200 OK
Content-Length: 40
Content-Encoding: gzip
00000000 1f 8b 08 00 00 00 00 00 02 ff
Why it matters
--silent is the mode the README's own monitoring script recommends, so the mode most likely to be deployed is the mode that hides the diagnostic. For binary and compressed responses the hex dumper — whose entire purpose is showing you the bytes — shows nothing usable.
Root cause
Rendering and transport framing are conflated: http.Response.Write is reused as a pretty-printer. The short-write error is discarded (_ = r.Write(w)), which is why this went unnoticed.
Affected code
main.go — httpResponse.writeTo
Suggested fix
Don't use http.Response.Write for human-readable output. Either format the status line + headers + rendered body manually, or set r.ContentLength = int64(len(rendered)) (and clear Transfer-Encoding) before writing. Stop discarding the write error.
Problem
httpResponse.writeToreplacesres.Bodywith a rendered representation (hex dump, cropped text, or a placeholder) but never updatesres.ContentLength. It then callsres.Write(w), which is an HTTP wire-format serializer and copies exactlyContentLengthbytes. Any rendered form longer than the original body gets cut off.Reproduction
a)
--silentmode — placeholder truncated to 4 characters (body isboom,Content-Length: 4):b) Binary body (8 bytes) — hex dump reduced to a single field:
c) gzip'd body (40 bytes) — hex dump cut mid-line:
Why it matters
--silentis the mode the README's own monitoring script recommends, so the mode most likely to be deployed is the mode that hides the diagnostic. For binary and compressed responses the hex dumper — whose entire purpose is showing you the bytes — shows nothing usable.Root cause
Rendering and transport framing are conflated:
http.Response.Writeis reused as a pretty-printer. The short-write error is discarded (_ = r.Write(w)), which is why this went unnoticed.Affected code
main.go—httpResponse.writeToSuggested fix
Don't use
http.Response.Writefor human-readable output. Either format the status line + headers + rendered body manually, or setr.ContentLength = int64(len(rendered))(and clearTransfer-Encoding) before writing. Stop discarding the write error.