def __init__(self, headers, body=''):
        # first of all, lets make sure that if headers or body are
        # unicode strings, it must be converted into a utf-8 encoded
        # byte string
        self.raw_headers = utf8(headers.strip())
        self.body = utf8(body)

        # Now let's concatenate the headers with the body, and create
        # `rfile` based on it
        self.rfile = StringIO(b'\r\n\r\n'.join([self.raw_headers, self.body]))

        # Creating `wfile` as an empty StringIO, just to avoid any
        # real I/O calls
        self.wfile = StringIO()

        # parsing the request line preemptively
        self.raw_requestline = self.rfile.readline()

        # initiating the error attributes with None
        self.error_code = None
        self.error_message = None

        # Parse the request based on the attributes above
        if not self.parse_request():
            return

        # making the HTTP method string available as the command
        self.method = self.command

        # Now 2 convenient attributes for the HTTPretty API:

        # `querystring` holds a dictionary with the parsed query string
        try:
            self.path = self.path.encode('iso-8859-1')
        except __HOLE__:
            pass

        self.path = decode_utf8(self.path)

        qstring = self.path.split("?", 1)[-1]
        self.querystring = self.parse_querystring(qstring)

        # And the body will be attempted to be parsed as
        # `application/json` or `application/x-www-form-urlencoded`
        self.parsed_body = self.parse_request_body(self.body)
dataset/ETHPy150Open gabrielfalcao/HTTPretty/httpretty/core.py/HTTPrettyRequest.__init__