Skip to content

Commit c8f633e

Browse files
authored
Merge pull request #7 from secondlife/signal/xml
Treat application/xml as application/llsd+xml
2 parents 94b3e71 + 2359b9e commit c8f633e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

llsd_asgi/middleware.py

+2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
2323

2424

2525
_CONTENT_TYPE_TO_PARSE = {
26+
"application/xml": llsd.parse_xml,
2627
"application/llsd+xml": llsd.parse_xml,
2728
"application/llsd+binary": llsd.parse_binary,
2829
"application/llsd+notation": llsd.parse_notation,
2930
}
3031

3132
_CONTENT_TYPE_TO_FORMAT = {
33+
"application/xml": llsd.format_xml,
3234
"application/llsd+xml": llsd.format_xml,
3335
"application/llsd+binary": llsd.format_binary,
3436
"application/llsd+notation": llsd.format_notation,

tests/test_middleware.py

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
@pytest.mark.parametrize(
2323
"content_type,format",
2424
[
25+
("application/xml", llsd.format_xml),
2526
("application/llsd+xml", llsd.format_xml),
2627
("application/llsd+binary", llsd.format_binary),
2728
("application/llsd+notation", llsd.format_notation),
@@ -105,6 +106,7 @@ async def app(scope: Scope, receive: Receive, send: Send) -> None:
105106
@pytest.mark.parametrize(
106107
"header,format,parse",
107108
[
109+
("application/xml", llsd.format_xml, llsd.parse_xml),
108110
("application/llsd+xml", llsd.format_xml, llsd.parse_xml),
109111
("application/llsd+binary", llsd.format_binary, llsd.parse_binary),
110112
("application/llsd+notation", llsd.format_notation, llsd.parse_notation),
@@ -137,6 +139,7 @@ async def test_llsd_accepted_but_response_is_not_json() -> None:
137139
@pytest.mark.parametrize(
138140
"header,format,parse",
139141
[
142+
("application/xml", llsd.format_xml, llsd.parse_xml),
140143
("application/llsd+xml", llsd.format_xml, llsd.parse_xml),
141144
("application/llsd+binary", llsd.format_binary, llsd.parse_binary),
142145
("application/llsd+notation", llsd.format_notation, llsd.parse_notation),

0 commit comments

Comments
 (0)