Skip to content

Commit

Permalink
Don't assume on the format of the serialized, use content_type
Browse files Browse the repository at this point in the history
  • Loading branch information
dstufft committed Jul 7, 2012
1 parent b61083b commit b7267fc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions slumber/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@ def get(self, **kwargs):

resp = self._request("GET", params=kwargs)
if 200 <= resp.status_code <= 299:
if resp.status_code == 200:
return s.loads(resp.content)
else:
try:
stype = s.get_serializer(content_type=resp.headers.get("content-type"))
except exceptions.SerializerNotAvailable:
return resp.content

return stype.loads(resp.content)
else:
return # @@@ We should probably do some sort of error here? (Is this even possible?)

Expand Down

0 comments on commit b7267fc

Please sign in to comment.