-
-
Notifications
You must be signed in to change notification settings - Fork 813
Closed
Labels
Description
I found myself wanting to use this method for simonw/datasette-auth-passwords#15 - but it's not documented. It should be documented.
datasette/datasette/utils/asgi.py
Lines 320 to 340 in 8e18c79
| async def asgi_send(self, send): | |
| headers = {} | |
| headers.update(self.headers) | |
| headers["content-type"] = self.content_type | |
| raw_headers = [ | |
| [key.encode("utf-8"), value.encode("utf-8")] | |
| for key, value in headers.items() | |
| ] | |
| for set_cookie in self._set_cookie_headers: | |
| raw_headers.append([b"set-cookie", set_cookie.encode("utf-8")]) | |
| await send( | |
| { | |
| "type": "http.response.start", | |
| "status": self.status, | |
| "headers": raw_headers, | |
| } | |
| ) | |
| body = self.body | |
| if not isinstance(body, bytes): | |
| body = body.encode("utf-8") | |
| await send({"type": "http.response.body", "body": body}) |
Reactions are currently unavailable