> In the past, I've used response_body.close in middleware for > similar things, and nowadays Rack::BodyProxy exists in rack, too. > > So I'm a little skeptical if this is actually needed, but it's > probably too late to do anything about:
The first approach we took uses Rack::Events, which I believe is using Rack::BodyProxy under the hood. We ran into an issue where all but the last line of the response is written and the connection isn’t actually closed yet when the callbacks are called. > Citation(s) needed. Also, are there any proposal(s) to get this > into the Rack specification? Not that I’m aware of. But I agree that it and early_hints could both be good additions to the spec. > I'll have to squash the following in, since an exception can be > raised if a client truncates the request: Good catch, sounds good to me. > Everything else seems OK. Thanks. Awesome, thanks for the quick reply/feedback.
