Skip to content

Preserve one-shot response bodies after validation - #483

Open
ydah wants to merge 1 commit into
masterfrom
fix-one-shot-response-body
Open

Preserve one-shot response bodies after validation#483
ydah wants to merge 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.

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.

1 participant