diff --git a/CHANGES/5657.misc b/CHANGES/5657.misc new file mode 100644 index 00000000000..d7d54e102eb --- /dev/null +++ b/CHANGES/5657.misc @@ -0,0 +1 @@ +Added regression test for ``HTTPUnauthorized`` body param diff --git a/tests/test_web_exceptions.py b/tests/test_web_exceptions.py index cf495db56ef..6c2bf63bd55 100644 --- a/tests/test_web_exceptions.py +++ b/tests/test_web_exceptions.py @@ -332,3 +332,15 @@ def test_pickle(self) -> None: assert resp2.reason == "Zaprescheno" assert resp2.status == 451 assert resp2.foo == "bar" + + +@pytest.mark.xfail( + raises=(TypeError, AttributeError), + reason="Regression in v3.7: https://github.com/aio-libs/aiohttp/issues/5657", +) +def test_body_unauthorized() -> None: + resp = web.HTTPUnauthorized( + headers={"X-Custom": "value"}, content_type="custom", body="text" + ) + assert resp.status == 401 + assert resp.text == "text"