diff options
| author | th3nn3ss <chuksmcdennis@yahoo.com> | 2022-12-21 14:25:24 -0500 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-04-03 14:01:48 +0200 |
| commit | 1d1ddffc27cd55c011298cd09bfa4de3fa73cf7a (patch) | |
| tree | c77c385a04bb16b84bab217258356cc480a85abc /tests/asgi/urls.py | |
| parent | 4e4eda6d6c8a5867dafd2ba9167ad8c064bb644a (diff) | |
Fixed #33738 -- Allowed handling ASGI http.disconnect in long-lived requests.
Diffstat (limited to 'tests/asgi/urls.py')
| -rw-r--r-- | tests/asgi/urls.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/asgi/urls.py b/tests/asgi/urls.py index 34595c1b6c..0f74fc9b97 100644 --- a/tests/asgi/urls.py +++ b/tests/asgi/urls.py @@ -1,4 +1,5 @@ import threading +import time from django.http import FileResponse, HttpResponse from django.urls import path @@ -10,6 +11,12 @@ def hello(request): return HttpResponse("Hello %s!" % name) +def hello_with_delay(request): + name = request.GET.get("name") or "World" + time.sleep(1) + return HttpResponse(f"Hello {name}!") + + def hello_meta(request): return HttpResponse( "From %s" % request.META.get("HTTP_REFERER") or "", @@ -46,4 +53,5 @@ urlpatterns = [ path("meta/", hello_meta), path("post/", post_echo), path("wait/", sync_waiter), + path("delayed_hello/", hello_with_delay), ] |
