add eof method to close stream (#2094)
* add eof method to close stream * Add eof test Co-authored-by: Ajay Gupta <ajay.gupta@1mg.com> Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
This commit is contained in:
@@ -203,6 +203,9 @@ class StreamingHTTPResponse(BaseHTTPResponse):
|
||||
self.streaming_fn = None
|
||||
await super().send(*args, **kwargs)
|
||||
|
||||
async def eof(self):
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class HTTPResponse(BaseHTTPResponse):
|
||||
"""
|
||||
@@ -235,6 +238,9 @@ class HTTPResponse(BaseHTTPResponse):
|
||||
self.headers = Header(headers or {})
|
||||
self._cookies = None
|
||||
|
||||
async def eof(self):
|
||||
await self.send("", True)
|
||||
|
||||
|
||||
def empty(
|
||||
status=204, headers: Optional[Dict[str, str]] = None
|
||||
|
||||
Reference in New Issue
Block a user