Create the Request object and returns either (request, None) or (None, response) if there is an error response.
(self, scope, body_file)
| 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.""" |
no test coverage detected