ISSUE DESCRIPTION Fail on HTTP Status 204 (No Content) Hello, I'm using Synadia Cloud…
- User
ISSUE DESCRIPTION
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
Let's view further to find where actual body decode + Decode() call happens (the normalizeResponse or similar).
Assistant
Now let's find
normalizeHTTPResponse.Assistant
Now let's find
output.Normalize.Assistant
Now let's check similar decompression paths in http.go (
rawResponseBodyBytesanddecompressedResponseBody) that could hit the same issue for raw/streaming responses.Assistant
I'll revert this and instead centralize the fix in the
Registry.Decompressfunction so all callers (raw body, streaming, normalize) benefit automatically.Assistant
Now let's check the build and existing tests for the content package.
Assistant
Build succeeds. Now let's write a reproduce script to simulate a 204 response with gzip Content-Encoding and empty body.
Assistant
I'll place the repro inside the repo's internal test area temporarily instead.
Assistant
Confirmed fix works. Let's verify pre-fix behavior would have failed by checking git stash temporarily (optional), then clean up repro dir.
Assistant
No test depends on that specific error path for empty bodies. Now let's run the existing test suite for content and cli packages to ensure nothing broke.
Assistant
All existing tests pass. Now let's simulate the full end-to-end scenario described in the issue: a real HTTP test server returning 204 with
Content-Encoding: gzipand empty body, then run restish's request flow against it.Assistant
This gives a nice mock transport mechanism. Let's write a temporary test using
UseResponsewith a 204 status, gzip Content-Encoding header, and empty body.Assistant
The end-to-end test passes with the fix. Let's confirm it would have failed before the fix by temporarily reverting.
Assistant
Confirmed — this reproduces the exact issue error. Restoring the fix now.
Assistant
Now remove the temporary test file (per instructions, don't add new tests to the repo).
Assistant
Now let's run the full test suite to be safe.
Assistant
All tests pass across the entire repository. Let's view the final diff.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.