[python] fix content_type deserialize (#19317)

* [Python] fix: #19285

* [python] update sample

* [python] add test

* [python] remove test
This commit is contained in:
ふぁ
2024-08-25 00:40:15 +09:00
committed by GitHub
parent 7a7c8c19ab
commit 69cce249f6
6 changed files with 42 additions and 10 deletions

View File

@@ -405,12 +405,12 @@ class ApiClient:
data = json.loads(response_text)
except ValueError:
data = response_text
elif content_type.startswith("application/json"):
elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
if response_text == "":
data = ""
else:
data = json.loads(response_text)
elif content_type.startswith("text/plain"):
elif re.match(r'^text/plain\s*(;|$)', content_type, re.IGNORECASE):
data = response_text
else:
raise ApiException(