Skip to content

fix(render): stop after channel timeout - #73

Open
awais-ur-rehman wants to merge 1 commit into
go-chi:masterfrom
awais-ur-rehman:feat/render-channel-timeout
Open

awais-ur-rehman wants to merge 1 commit into
go-chi:masterfrom
awais-ur-rehman:feat/render-channel-timeout

Conversation

@awais-ur-rehman

Copy link
Copy Markdown

Summary

When a request is canceled while DefaultResponder is collecting a channel response, it sends a 504 and then runs the requested serializer. That appends null for JSON or an XML declaration to the plain-text timeout body. Have the channel collector report cancellation so the responder can send the 504 and return.

Fixes #71.

Testing

  • go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
  • go vet ./...
  • go build ./...

The regression tests use the public responder to verify the 504 status, content type, and exact timeout body for JSON and XML clients. They also check the JSON output for empty and populated channels that close normally.

Breaking changes

None.

Disclosure

I used OpenAI Codex to reproduce the issue, prepare the patch and tests, and run local verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Channel response appends JSON null after context timeout

1 participant