async def METHOD_NAME(
    aiohttp_server: _TestServerFactory, api_factory: _ApiFactory
) -> None:
    ERROR_MSG = "this is the error message"
    ERROR_PAYLOAD = json.dumps({"error": ERROR_MSG})
    async def handler(request: web.Request) -> web.Response:
        raise web.HTTPBadRequest(text=ERROR_PAYLOAD, headers={"X-Error": ERROR_PAYLOAD})
    app = web.Application()
    app.router.add_get("/test", handler)
    srv = await aiohttp_server(app)
    async with api_factory(srv.make_url("/")) as api:
        with pytest.raises(IllegalArgumentError, match=f"^{ERROR_MSG}$"):
            async with api.ws_connect(abs_url=srv.make_url("test"), auth="auth"):
                pass