We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 5647169 + 9aac82f commit 2d27d73Copy full SHA for 2d27d73
annofabapi/__version__.py
@@ -1 +1 @@
1
-__version__ = '0.25.1'
+__version__ = '0.25.2'
annofabapi/api.py
@@ -157,10 +157,14 @@ def _response_to_content(response: requests.Response) -> Any:
157
"""
158
159
content_type = response.headers['Content-Type']
160
- if content_type == 'application/json':
+ # `Content-Type: application/json;charset=utf-8`などcharsetが含まれている場合にも対応できるようにする。
161
+ tokens = content_type.split(';')
162
+ media_type = tokens[0].strip()
163
+
164
+ if media_type == 'application/json':
165
content = response.json() if len(response.content) != 0 else {}
166
- elif content_type.find('text/') >= 0:
167
+ elif media_type.find('text/') >= 0:
168
content = response.text
169
170
else:
0 commit comments