Skip to content

Commit e8a0ce3

Browse files
committed
fix: Use source "response.text" for any mime-type starting with text/
Responses with "Content-Type: text/csv" or "Content-Type: text/xml" ought to be treated the same as text/html
1 parent 7b38b52 commit e8a0ce3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

openapi_python_client/parser/responses.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ class Response:
2222

2323

2424
def _source_by_content_type(content_type: str) -> Optional[str]:
25+
if content_type.startswith("text/"):
26+
return "response.text"
2527
known_content_types = {
2628
"application/json": "response.json()",
2729
"application/octet-stream": "response.content",
28-
"text/html": "response.text",
2930
}
3031
source = known_content_types.get(content_type)
3132
if source is None and content_type.endswith("+json"):

0 commit comments

Comments
 (0)