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 tests. First a registry-level test for empty streams per encoding:
- Assistant
All targeted tests pass. Now run the full suite including integration tests since this touches CLI response behavior:
- Assistant
Fixed. The issue and what changed:
Root cause
Some servers (like Synadia Cloud) set
Content-Encoding: gzipon204 No Contentresponses that have an empty body. Restish'sRegistry.Decompresshanded the empty stream straight togzip.NewReader, which immediately tries to read the gzip header and fails withEOF— producingERROR: Parse response error / Caught error: EOF.Fix
internal/content/registry.go— inRegistry.Decompress, when a real encoding is requested, peek one byte before constructing the decompressor. If the stream is empty (io.EOFon peek), return it as-is instead of treating it as corrupt compressed data. Fixing it here covers all call sites: response normalization (internal/output/response.go), streaming (internal/cli/stream.go), and cached-response handling (internal/cli/http.go) — and all encodings (gzip, deflate, brotli), not just gzip.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.