lib/http.py
changeset 25 8f143b1ce0d1
parent 14 b88d23696b98
child 42 5a72c00c4ae4
equal deleted inserted replaced
24:a84322e9df8d 25:8f143b1ce0d1
    92 class Response (object) :
    92 class Response (object) :
    93     """
    93     """
    94         HTTP Response with headers and data
    94         HTTP Response with headers and data
    95     """
    95     """
    96 
    96 
    97     def __init__ (self, data, content_type='text/html', status='200 OK', charset='utf8') :
    97     def __init__ (self, data, content_type='text/html', status='200 OK', charset='UTF-8') :
    98         """
    98         """
    99             Create the response. The Content-type header is built from the given values. The given \a data must be
    99             Create the response. The Content-type header is built from the given values. The given \a data must be
   100             either a str (which is sent plain), an unicode object (which is encoded with the relevant charset), or
   100             either a str (which is sent plain), an unicode object (which is encoded with the relevant charset), or
   101             None, whereupon an empty response body is sent. The content_type argument can also be forced to None to
   101             None, whereupon an empty response body is sent. The content_type argument can also be forced to None to
   102             not send a Content-type header (e.g. for redirects)
   102             not send a Content-type header (e.g. for redirects)