Exemple #1
0
 def _get_post_files_from_environ(self):
     if self.environ.get('REQUEST_METHOD') not in ('POST', 'PUT', 'PATCH'):
         post = files = ImmutableMultiDict()
     else:
         copy_wsgi_input(self.environ)
         post, files = get_form_vars(self.environ, ImmutableMultiDict)
     return post, files
Exemple #2
0
    def body(self):
        """Return the body of the request as a string.

        If unable to decode, return empty body.
        """
        copy_wsgi_input(self.environ)
        body = self.raw_body
        if isinstance(body, bytes):
            try:
                body = body.decode(self.encoding)
            except:
                body = ''
        return body
Exemple #3
0
 def body(self):
     copy_wsgi_input(self.environ)
     return self.raw_body.decode(self.encoding)