Fix stream cancellation in `RenderResult.pipe()` and `sendResponse()` (#52157)
### What? I've found 2 more spots that didn't properly cancel the streaming response when the client disconnects. This fixes `RenderResult.pipe()` (called during dynamic render results) and `sendResponse()` (used during Route Handlers using `nodejs` runtime). It also (finally) adds tests for all the cases I'm aware of. ### Why? To allow disconnecting from an AI service when a client disconnects. $$$ ### How? Just checks for `response.closed`, which will be closed when the client's connection disconnects.
Showing
Please
register
or
sign in
to comment