Skip to content

Validate streaming responses from sent chunks - #484

Open
ydah wants to merge 1 commit into
masterfrom
fix/streaming-body-validation
Open

ydah wants to merge 1 commit into
masterfrom
fix/streaming-body-validation

Conversation

@ydah

@ydah ydah commented Sep 16, 2026

Copy link
Copy Markdown
Member

Streaming response validation runs from a Rack::BodyProxy close callback and currently re-enumerates the original response body. Rack closes that body before invoking the callback, so one-shot bodies validate as empty and close-sensitive bodies raise IOError after the response has already been sent.

Wrap streaming enumeration to collect the chunks yielded to the client, then validate those captured chunks from the close callback. The original response body is still closed before validation.

@geemus

geemus commented Sep 18, 2026

Copy link
Copy Markdown
Member

@ydah broadly looks good. I have some concern about memory bloat though, especially if for any reason the extra copy of the data doesn't get garbage collected promptly. Any thoughts on how we could mitigate that or at least identify if it is a real concern?

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