[New-bugs-announce] [issue1492] BaseHTTPServer hard-codes Content-Type for error messages

samwyse report at bugs.python.org
Fri Nov 23 14:04:07 CET 2007

New submission from samwyse:

The send_error method always sends a Content-Type of 'text/html'.  Other
content types are both possible and desirable.  For example, someone
writing a REST server might wish to send XML error messages.  Following
the example of DEFAULT_ERROR_MESSAGE, I propose adding the following in
the appropriate places:

> # Default error content-type
> DEFAULT_ERROR_TYPE = 'text/html'
<         self.send_header("Content-Type", "text/html")
>         self.send_header("Content-Type", error_message_type)
>     error_message_type = DEFAULT_ERROR_TYPE

messages: 57784
nosy: samwyse
severity: normal
status: open
title: BaseHTTPServer hard-codes Content-Type for error messages

Tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list