async def METHOD_NAME(
    app, http_client, auth_creds, content_type_map, http_server_port
):
    app.mod_opts["cors_origin"] = "http://example.com"
    response = await http_client.fetch(
        "/login",
        method="POST",
        body=urllib.parse.urlencode(auth_creds),
        headers={"Content-Type": content_type_map["form"]},
    )
    token = salt.utils.json.loads(response.body)["return"][0]["token"]
    url = "ws://127.0.0.1:{}/all_events/{}".format(http_server_port, token)
    # Example.com should works
    request = HTTPRequest(
        url, headers={"Origin": "http://example.com", "Host": "example.com"}
    )
    ws = await websocket_connect(request)
    ws.write_message("websocket client ready")
    ws.close()
    # But foo.bar not
    request = HTTPRequest(
        url, headers={"Origin": "http://foo.bar", "Host": "example.com"}
    )
    with pytest.raises(HTTPError) as exc:
        await websocket_connect(request)
    assert exc.value.code == 403