async def METHOD_NAME(message: typing.Dict[str, typing.Any]) -> None:
    nonlocal status_code, response_headers, response_started
    if message["type"] == "http.response.start":
        assert not response_started
        status_code = message["status"]
        response_headers = message.get("headers", [])
        response_started = True
    elif message["type"] == "http.response.body":
        assert not response_complete.is_set()
        body = message.get("body", b"")
        more_body = message.get("more_body", False)
        if body and request.method != "HEAD":
            body_parts.append(body)
        if not more_body:
            response_complete.set()