summaryrefslogtreecommitdiff
path: root/tests/middleware_exceptions
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-04-06 08:03:43 +0200
committerGitHub <noreply@github.com>2021-04-06 08:03:43 +0200
commit78fea27f690028204c03c28d821cb0c0240a7398 (patch)
tree492f4fc09abc301dc92c6e3739aad908c3a012fc /tests/middleware_exceptions
parent0f7afd6599fd4191231a8897258807c8c24deedf (diff)
downloaddjango-78fea27f690028204c03c28d821cb0c0240a7398.tar.gz
Fixed #32614 -- Fixed MiddlewareSyncAsyncTests tests with asgiref 3.3.2+.
Diffstat (limited to 'tests/middleware_exceptions')
-rw-r--r--tests/middleware_exceptions/middleware.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/middleware_exceptions/middleware.py b/tests/middleware_exceptions/middleware.py
index 9fb9726b50..b87da84b9d 100644
--- a/tests/middleware_exceptions/middleware.py
+++ b/tests/middleware_exceptions/middleware.py
@@ -1,3 +1,5 @@
+import asyncio
+
from django.http import Http404, HttpResponse
from django.template import engines
from django.template.response import TemplateResponse
@@ -11,6 +13,9 @@ log = []
class BaseMiddleware:
def __init__(self, get_response):
self.get_response = get_response
+ if asyncio.iscoroutinefunction(self.get_response):
+ # Mark the class as async-capable.
+ self._is_coroutine = asyncio.coroutines._is_coroutine
def __call__(self, request):
return self.get_response(request)