Skip to content

Commit

Permalink
Merge pull request #6 from secondlife/signal/xml
Browse files Browse the repository at this point in the history
Default content-type to xml when in quirks mode
  • Loading branch information
bennettgoble authored Mar 14, 2024
2 parents a290d8d + 61cbd54 commit 94b3e71
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions llsd_asgi/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/test_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!"}


Expand Down

0 comments on commit 94b3e71

Please sign in to comment.