Skip to content
This repository was archived by the owner on Mar 18, 2019. It is now read-only.

Supporting the case where there is error and DownloadCoded is enabled #150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions coreapi/transports/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ def _coerce_to_error(obj, default_title):
return Error(title=default_title, content={'messages': obj})
elif obj is None:
return Error(title=default_title)
elif hasattr(obj, "read"):
return Error(title=default_title, content={'messages': obj.read().decode("utf-8")})
return Error(title=default_title, content={'message': obj})


Expand Down