Every line of 'python request response body' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
740 def _get_body(response): 741 return response.content
17 async def request_body(self): 18 ''' Returns the body of the current request. ''' 19 if self.request.has_body: 20 return await self.request.text() 21 return {}
23 @pytest.fixture 24 def request_body(): 25 return StringIO('TESTS')
214 @property 215 def raw_body(self): 216 return self._raw_body
339 def read_body(self): 340 """ Returns the string body that was read off the request, or 341 the empty string if there was no request body. 342 343 Requires a content-length header. Caches the body so multiple 344 calls to read_body() are free. 345 """ 346 if not hasattr(self, '_cached_body'): 347 length = self.get_header('content-length') 348 if length: 349 length = int(length) 350 if length: 351 self._cached_body = self.protocol.rfile.read(length) 352 else: 353 self._cached_body = '' 354 return self._cached_body