diff --git a/llsd_asgi/middleware.py b/llsd_asgi/middleware.py index 4dc05bd..2d35841 100644 --- a/llsd_asgi/middleware.py +++ b/llsd_asgi/middleware.py @@ -147,8 +147,8 @@ async def send_with_llsd(self, message: Message) -> None: if self.accept_header: headers["Content-Type"] = self.accept_header else: - # quirks mode allows a response without a Content-Type response header - del headers["Content-Type"] + # quirks mode allows a response to default to application/xml instead of application/llsd+xml + headers["Content-Type"] = "application/xml" headers["Content-Length"] = str(len(body)) message["body"] = body diff --git a/tests/test_middleware.py b/tests/test_middleware.py index 1f4662b..a7e2d66 100644 --- a/tests/test_middleware.py +++ b/tests/test_middleware.py @@ -196,7 +196,7 @@ async def test_quirks_encode(accept: str) -> None: headers["accept"] = accept r = await client.get("/") assert r.status_code == 200 - assert "content-type" not in r.headers + assert r.headers["content-type"] == "application/xml" assert llsd.parse_xml(r.content) == {"message": "Hello, world!"}