MCPcopy
hub / github.com/django/django / create_request

Method create_request

django/core/handlers/asgi.py:269–284  ·  view source on GitHub ↗

Create the Request object and returns either (request, None) or (None, response) if there is an error response.

(self, scope, body_file)

Source from the content-addressed store, hash-verified

267 return body_file
268
269 def create_request(self, scope, body_file):
270 """
271 Create the Request object and returns either (request, None) or
272 (None, response) if there is an error response.
273 """
274 try:
275 return self.request_class(scope, body_file), None
276 except UnicodeDecodeError:
277 logger.warning(
278 "Bad Request (UnicodeDecodeError)",
279 exc_info=sys.exc_info(),
280 extra={"status_code": 400},
281 )
282 return None, HttpResponseBadRequest()
283 except RequestDataTooBig:
284 return None, HttpResponse("413 Payload too large", status=413)
285
286 def handle_uncaught_exception(self, request, resolver, exc_info):
287 """Last-chance handler for exceptions."""

Callers 1

handleMethod · 0.95

Calls 2

HttpResponseClass · 0.90

Tested by

no test coverage detected