async def METHOD_NAME(message: ASGISendEvent) -> None:
    if message["type"] == "http.response.start":
        response_headers = [
            (key, value)
            for key, value in message["headers"]
            if key.lower()
            not in {
                b"access-control-allow-credentials",
                b"access-control-allow-origin",
                b"vary",
            }
        ]
        response_headers.append(
            (b"access-control-allow-credentials", b"true")
        )
        vary_header = next(
            (
                value
                for key, value in message["headers"]
                if key.lower() == b"vary"
            ),
            b"",
        )
        if origin_match:
            response_headers.append(
                (
                    b"access-control-allow-origin",
                    request_origin.encode("latin1"),
                )
            )
            if b"Origin" not in vary_header:
                if vary_header:
                    vary_header += b", Origin"
                else:
                    vary_header = b"Origin"
        if vary_header:
            response_headers.append((b"vary", vary_header))
        message["headers"] = sorted(response_headers)
    await send(message)