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
Investigating how Restish handles 204 No Content responses and empty bodies with Content-Encoding headers.
- Assistant
Verifying decompressor behavior on empty input and locating the best fix point.
- Assistant
Implementing empty-body handling in
Decompress— all built-in decompressors fail on empty input whenContent-Encodingis set. - Assistant
The failure came from Synadia (and similar APIs) returning 204 No Content with
Content-Encoding: gzipbut no body. Restish always tried to decompress when that header was present, andgzip.NewReaderon an empty stream returnsEOF.Fix
Decompressininternal/content/registry.gonow checks whether the response body is empty before decompressing. If there are no bytes to read, it returns an empty reader instead of invoking gzip/deflate/brotli.300:336:internal/content/registry.go
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.