Skip to content Skip to sidebar Skip to footer

Why Does Wsgiref.simple_server Report Content-type Of Request As 'text/plain' While None Was Sent?

Output from client.py is text/plain although no content-type header was sent to the server. Why? # ---------------------------------------------- server.py from wsgiref.simple_serv

Solution 1:

The type text/plain is the default for MIME, in section 5.2 Content Type Defaults.

The WSGI simple_server uses BaseHTTPRequestHandler which in turn uses a mimetools.Message class to parse the headers sent by the client -- here is where it sets the default:

# mimetools.pyclassMessage(rfc822.Message):

    defparsetype(self):
        str = self.typeheader
        ifstrisNone:
            str = 'text/plain'

Post a Comment for "Why Does Wsgiref.simple_server Report Content-type Of Request As 'text/plain' While None Was Sent?"