Skip to content

Commit 296edd6

Browse files
authored
fix: content-type issue (#112)
1 parent 1e4094c commit 296edd6

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

routingpy/client_default.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,10 @@ def _get_body(response):
229229
content_type = response.headers["content-type"]
230230

231231
if status_code == 200:
232-
if content_type in ["application/json", "application/x-www-form-urlencoded"]:
232+
if content_type == "image/tiff":
233+
return response.content
234+
235+
else:
233236
try:
234237
return response.json()
235238

@@ -238,12 +241,6 @@ def _get_body(response):
238241
"Can't decode JSON response:{}".format(response.text)
239242
)
240243

241-
elif content_type == "image/tiff":
242-
return response.content
243-
244-
else:
245-
raise exceptions.UnsupportedContentType(status_code, response.text)
246-
247244
if status_code == 429:
248245
raise exceptions.OverQueryLimit(status_code, response.text)
249246

routingpy/exceptions.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,3 @@ class OverQueryLimit(RouterError, RetriableRequest):
7171
"""
7272

7373
pass
74-
75-
76-
class UnsupportedContentType(Exception): # pragma: no cover
77-
"""The response has an unsupported content type."""
78-
79-
pass

0 commit comments

Comments
 (0)