mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
Fix 500 error on overly-large API request body
Paster doesn't mind unicode responses, but gunicorn wants byte strings
only:
Error handling request
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/gunicorn/workers/sync.py", line 131, in handle_request
resp.write(item)
File "/usr/lib/python2.7/dist-packages/gunicorn/http/wsgi.py", line 283, in write
assert isinstance(arg, binary_type), "%r is not a byte." % arg
AssertionError: u'{' is not a byte.
See https://gist.github.com/JordanMilne/4a7d1b5eb317e607479b for repro
This commit is contained in:
@@ -317,7 +317,7 @@ def _wsgi_json(start_response, status_int, message=""):
|
||||
"error": status_int,
|
||||
"message": message
|
||||
})
|
||||
return filters.websafe_json(data)
|
||||
return [filters.websafe_json(data).encode("utf-8")]
|
||||
|
||||
|
||||
class LimitUploadSize(object):
|
||||
|
||||
Reference in New Issue
Block a user