Skip to content

Commit

Permalink
Add regression test for #8395
Browse files Browse the repository at this point in the history
Ref #8395
PR #8396
  • Loading branch information
ddeville authored May 3, 2024
1 parent 0ba6cf2 commit 42906a6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_client_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -3644,3 +3644,24 @@ async def handler(_: web.Request) -> web.Response:
session = await aiohttp_client(app, raise_for_status=None) # type: ignore[arg-type]

await session.get("/")


@pytest.mark.xfail(
reason="#8395 Error message regression for large headers in 3.9.4",
raises=AssertionError,
)
async def test_header_too_large_error(aiohttp_client: Any) -> None:
"""By default when not specifying `max_field_size` requests should fail with a 400 status code."""

async def handler(_: web.Request) -> web.Response:
return web.Response(headers={"VeryLargeHeader": "x" * 10000})

app = web.Application()
app.add_routes([web.get("/", handler)])
client = await aiohttp_client(app)

with pytest.raises(
aiohttp.ClientResponseError, match="Got more than 8190 bytes*"
) as exc_info:
await client.get("/")
assert exc_info.value.status == 400

0 comments on commit 42906a6

Please sign in to comment.