Fix a response header bug in the error middleware
Coerce the Content-Length of the custom error message to a string, not an integer. Some pure Python WSGI servers aren't strict and violate the WSGI specification by automatically converting the value to a string. Apache, however, *is* strict, and considers this a 500 Internal Error Fixes bug 1306963 Change-Id: I9b82ceee096b00c21c3b230dc67701bc40629968
This commit is contained in:
parent
c56e9aac4f
commit
381d9ba941
@ -124,7 +124,7 @@ class ParsableErrorMiddleware(object):
|
||||
except ValueError as err:
|
||||
body = [json.dumps({'error_message': '\n'.join(app_iter)})]
|
||||
state['headers'].append(('Content-Type', 'application/json'))
|
||||
state['headers'].append(('Content-Length', len(body[0])))
|
||||
state['headers'].append(('Content-Length', str(len(body[0]))))
|
||||
else:
|
||||
body = app_iter
|
||||
return body
|
||||
|
Loading…
x
Reference in New Issue
Block a user