Skip to content

Commit

Permalink
Added prettified output to JSON responses when debug=True
Browse files Browse the repository at this point in the history
  • Loading branch information
nullism committed May 15, 2016
1 parent 999e98e commit 5297caa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pycnic/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,11 @@ def __iter__(self):
resp = { "error": "Internal server error encountered." }

if isinstance(resp, dict):
return iter([json.dumps(resp).encode('utf-8')])
if self.debug:
jresp = json.dumps(resp, indent=4)
else:
jresp = json.dumps(resp)
return iter([jresp.encode('utf-8')])
elif isinstance(resp, str):
return iter([resp.encode('utf-8')])
else:
Expand Down

0 comments on commit 5297caa

Please sign in to comment.