When req.stream is set to a generator, but the client disconnects prior to exhausting iteration, we could communicate this by throwing a specialized exception via .throw() or .athrow (async), respectively.
Also decide whether this a good idea™ at all.
For WSGI, this would probably require wrapping the generator, and checking whether the generator was exhausted prior to calling its .close() method by the WSGI server.
For ASGI, this would require implementing a mechanism to detect disconnect events while streaming, for instance, as proposed in #2015.
This is a breaking change if enabled by default; but it could also be made configurable by resp_options.
When
req.stream
is set to a generator, but the client disconnects prior to exhausting iteration, we could communicate this by throwing a specialized exception via.throw()
or.athrow
(async
), respectively. Also decide whether this a good idea™ at all.For WSGI, this would probably require wrapping the generator, and checking whether the generator was exhausted prior to calling its
.close()
method by the WSGI server. For ASGI, this would require implementing a mechanism to detect disconnect events while streaming, for instance, as proposed in #2015.This is a breaking change if enabled by default; but it could also be made configurable by
resp_options
.