async def asgi_send(self, message: dict) -> None:
if message["<STR_LIT:type>"] == "<STR_LIT>" and self.state == ASGIHTTPState.REQUEST:<EOL><INDENT>self.response = message<EOL><DEDENT>elif message["<STR_LIT:type>"] == "<STR_LIT>" and self.state in {<EOL>ASGIHTTPState.REQUEST,<EOL>ASGIHTTPState.RESPONSE,<EOL>}:<EOL><INDENT>if self.state == ASGIHTTPState.REQUEST:<EOL><INDENT>headers = build_and_validate_headers(self.response["<STR_LIT>"])<EOL>headers.extend(self.response_headers())<EOL>await self.asend(<EOL>h11.Response(status_code=int(self.response["<STR_LIT:status>"]), headers=headers)<EOL>)<EOL>self.state = ASGIHTTPState.RESPONSE<EOL><DEDENT>if (<EOL>not suppress_body(self.scope["<STR_LIT>"], int(self.response["<STR_LIT:status>"]))<EOL>and message.get("<STR_LIT:body>", b"<STR_LIT>") != b"<STR_LIT>"<EOL>):<EOL><INDENT>await self.asend(h11.Data(data=bytes(message["<STR_LIT:body>"])))<EOL><DEDENT>if not message.get("<STR_LIT>", False):<EOL><INDENT>if self.state != ASGIHTTPState.CLOSED:<EOL><INDENT>await self.asend(h11.EndOfMessage())<EOL>await self.asgi_put({"<STR_LIT:type>": "<STR_LIT>"})<EOL>self.state = ASGIHTTPState.CLOSED<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>raise UnexpectedMessage(self.state, message["<STR_LIT:type>"])<EOL><DEDENT>
Called by the ASGI instance to send a message.