Fail on HTTP Status 204 (No Content) Hello, I'm using Synadia Cloud which has a DELETE…
- User
Fail on HTTP Status 204 (No Content) Hello,
I'm using Synadia Cloud which has a
DELETEAPI that returns a response with no body.code$ restish synadia delete-nats-user --help Deletes a NATS user from an account ## Argument Schema: { user-id: (string) } ## Responses 204/400/401/403/404 Response has no bodyIn this case, it's expected to have an empty body. Nevertheless,
restishfails with the error:codeERROR: Parse response error ERROR: Caught error: EOFHere is the full log:
code - Assistant
Now add a regression test:
- Assistant
Verify the new tests actually fail without the fix:
- Assistant
All tests pass, including the integration suite.
Summary
The bug: some servers (like Synadia Cloud) set
Content-Encoding: gzipon bodiless responses such as204 No Content. Restish fed the empty stream to the gzip decompressor, which failed withEOFbecause there's no gzip header to read.Fix —
internal/content/registry.go:302(Registry.Decompress): before handing the stream to a decompressor, peek one byte. If the stream is empty (io.EOF), return it as-is — an empty stream is an empty body, not a truncated compressed payload. Since all response-decoding paths (output.Normalize,rawResponseBodyBytes,decompressedResponseBody, streaming) go throughRegistry.Decompress, this single change covers them all. Non-empty streams and non-EOF errors behave exactly as before.Tests:
TestDecompressEmptyBodyIsEmpty(internal/content/registry_test.go) — empty stream withgzip/deflate/brencodings decodes to an empty body.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.