Skip to content

Commit 94b3e71

Browse files
authored
Merge pull request #6 from secondlife/signal/xml
Default content-type to xml when in quirks mode
2 parents a290d8d + 61cbd54 commit 94b3e71

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

llsd_asgi/middleware.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ async def send_with_llsd(self, message: Message) -> None:
147147
if self.accept_header:
148148
headers["Content-Type"] = self.accept_header
149149
else:
150-
# quirks mode allows a response without a Content-Type response header
151-
del headers["Content-Type"]
150+
# quirks mode allows a response to default to application/xml instead of application/llsd+xml
151+
headers["Content-Type"] = "application/xml"
152152
headers["Content-Length"] = str(len(body))
153153
message["body"] = body
154154

tests/test_middleware.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ async def test_quirks_encode(accept: str) -> None:
196196
headers["accept"] = accept
197197
r = await client.get("/")
198198
assert r.status_code == 200
199-
assert "content-type" not in r.headers
199+
assert r.headers["content-type"] == "application/xml"
200200
assert llsd.parse_xml(r.content) == {"message": "Hello, world!"}
201201

202202

0 commit comments

Comments
 (0)