diff options
Diffstat (limited to 'django/core/handlers/asgi.py')
-rw-r--r-- | django/core/handlers/asgi.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/django/core/handlers/asgi.py b/django/core/handlers/asgi.py index 11c8bc209b..cfe5101ea4 100644 --- a/django/core/handlers/asgi.py +++ b/django/core/handlers/asgi.py @@ -171,14 +171,14 @@ class ASGIHandler(base.BaseHandler): ) # Get the request and check for basic issues. request, error_response = self.create_request(scope, body_file) + if request is None: + await self.send_response(error_response, send) + return + # Get the response, using the async mode of BaseHandler. + response = await self.get_response_async(request) + response._handler_class = self.__class__ finally: body_file.close() - if request is None: - await self.send_response(error_response, send) - return - # Get the response, using the async mode of BaseHandler. - response = await self.get_response_async(request) - response._handler_class = self.__class__ # Increase chunk size on file responses (ASGI servers handles low-level # chunking). if isinstance(response, FileResponse): |