Skip to content

Commit

Permalink
Add regression test for aio-libs#8395
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeville committed May 1, 2024
1 parent 0ba6cf2 commit 94792e2
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_client_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -3644,3 +3644,27 @@ 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)

try:
await client.get("/")
except ClientResponseError as e:
assert e.status == 400
assert "Got more than 8190 bytes" in e.message
else:
raise AssertionError("Expected ClientResponseError")

0 comments on commit 94792e2

Please sign in to comment.