From 5c120bd9a2ba4a9366c80c119aac2f2ddc6e8149 Mon Sep 17 00:00:00 2001 From: ianb Date: Tue, 28 Feb 2006 21:16:56 +0000 Subject: 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 --- paste/httpexceptions.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'paste/httpexceptions.py') 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 = ( -- cgit v1.2.1