Skip to content

Commit

Permalink
Set content type in json_error to application/json
Browse files Browse the repository at this point in the history
  • Loading branch information
rgbkrk committed Jun 22, 2015
1 parent 64966ea commit c2078a5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions IPython/html/base/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ def wrapper(self, *args, **kwargs):
message = e.log_message
self.log.warn(message)
self.set_status(e.status_code)
self.set_header('Content-Type', 'application/json')
self.finish(json.dumps(dict(message=message)))
except Exception:
self.log.error("Unhandled error in API request", exc_info=True)
Expand All @@ -348,6 +349,7 @@ def wrapper(self, *args, **kwargs):
self.set_status(status)
tb_text = ''.join(traceback.format_exception(t, value, tb))
reply = dict(message=message, traceback=tb_text)
self.set_header('Content-Type', 'application/json')
self.finish(json.dumps(reply))
else:
return result
Expand Down

0 comments on commit c2078a5

Please sign in to comment.