Skip to content

Preserve one-shot response bodies after validation - #483

Merged
geemus merged 1 commit into
masterfrom
fix-one-shot-response-body
Sep 16, 2026
Merged

geemus merged 1 commit into
masterfrom
fix-one-shot-response-body

Conversation

@ydah

@ydah ydah commented Sep 8, 2026

Copy link
Copy Markdown
Member

Response validation enumerates the application response body to build the complete payload, then returns the same body object to the Rack server. Bodies backed by an IO, queue, or other one-shot enumerable are therefore empty when the server enumerates them again.

Buffer non-streaming response bodies selected for validation and use the buffered chunks for both schema validation and the returned Rack response. The original body is closed in an ensure block after it has been consumed. Responses that do not require validation and the existing streaming_content_parsers path retain their current behavior.

@geemus geemus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@geemus
geemus merged commit b3935af into master Sep 16, 2026
9 checks passed
@geemus
geemus deleted the fix-one-shot-response-body branch September 16, 2026 13:30
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.

2 participants