diff options
author | ianb <devnull@localhost> | 2006-02-28 21:16:56 +0000 |
---|---|---|
committer | ianb <devnull@localhost> | 2006-02-28 21:16:56 +0000 |
commit | 5c120bd9a2ba4a9366c80c119aac2f2ddc6e8149 (patch) | |
tree | 240e6343c68008fa16292268603c1734e9fb543e /paste/httpexceptions.py | |
parent | 7175904b9e3878dc971085161be104a1af3a9d44 (diff) | |
download | paste-5c120bd9a2ba4a9366c80c119aac2f2ddc6e8149.tar.gz |
Make sure that even if content-type is passed in to the HTTPExceptions constructor (as a header) we overwrite the header with the actual content type we are sending
Diffstat (limited to 'paste/httpexceptions.py')
-rw-r--r-- | paste/httpexceptions.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/paste/httpexceptions.py b/paste/httpexceptions.py index 9952b68..25a6d53 100644 --- a/paste/httpexceptions.py +++ b/paste/httpexceptions.py @@ -224,14 +224,16 @@ class HTTPException(Exception): """ This exception as a WSGI application """ + if self.headers: + headers = list(self.headers) + else: + headers = [] if 'html' in environ.get('HTTP_ACCEPT',''): - headers = [('content-type', 'text/html')] + replace_header(headers, 'content-type', 'text/html') content = self.html(environ) else: - headers = [('content-type', 'text/plain')] + replace_header(headers, 'content-type', 'text/plain') content = self.plain(environ) - if self.headers: - headers.extend(self.headers) if isinstance(content, unicode): content = content.encode('utf8') cur_content_type = ( |