Skip to content
22 changes: 22 additions & 0 deletions tests/test_web_urldispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,28 @@ async def get(self) -> web.Response:
assert r.status == 200


@pytest.mark.xfail(reason="https://github.com/aio-libs/aiohttp/issues/11665")
async def test_subapp_domain_routing_same_path(aiohttp_client: AiohttpClient) -> None:
app = web.Application()
sub_app = web.Application()

async def mainapp_handler(request: web.Request) -> web.Response:
assert False

async def subapp_handler(request: web.Request) -> web.Response:
return web.Response(text="SUBAPP")

app.router.add_get("/", mainapp_handler)
sub_app.router.add_get("/", subapp_handler)
app.add_domain("different.example.com", sub_app)

client = await aiohttp_client(app)
async with client.get("/", headers={"Host": "different.example.com"}) as r:
assert r.status == 200
Comment thread
Dreamsorcerer marked this conversation as resolved.
result = await r.text()
assert result == "SUBAPP"


async def test_route_with_regex(aiohttp_client: AiohttpClient) -> None:
"""Test a route with a regex preceded by a fixed string."""
app = web.Application()
Expand Down
Loading