Commit a8e01e9f authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Implement support for additional headers with HTTP errors

Reviewed-by: amishchenko
parent f30ca1e6
......@@ -111,10 +111,10 @@ class HttpException(Exception):
code = None
message = None
def __init__(self, message=None):
def __init__(self, message=None, headers=None):
Exception.__init__(self)
if message is not None:
self.message = message
self.message = message
self.headers = headers
class HttpBadRequest(HttpException):
......
......@@ -388,9 +388,13 @@ class _HttpServerRequestExecutor(object):
}
self.response_msg.start_line.code = err.code
self.response_msg.headers = {
http.HTTP_CONTENT_TYPE: self.error_content_type,
}
headers = {}
if err.headers:
headers.update(err.headers)
headers[http.HTTP_CONTENT_TYPE] = self.error_content_type
self.response_msg.headers = headers
self.response_msg.body = self.error_message_format % values
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment