summaryrefslogtreecommitdiffhomepage
path: root/test/test_asgi_application.py
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2020-11-10 22:27:08 +0300
committerMax Romanov <max.romanov@nginx.com>2020-11-10 22:27:08 +0300
commit5fd2933d2e54a7b5781698a670abf89b1031db44 (patch)
tree7d682ba1785ac883760331b4d123b0c17eaed10e /test/test_asgi_application.py
parent4ca9ba34081c44f5d421b171ffaf874fb341d73f (diff)
downloadunit-5fd2933d2e54a7b5781698a670abf89b1031db44.tar.gz
unit-5fd2933d2e54a7b5781698a670abf89b1031db44.tar.bz2
Python: supporting ASGI legacy protocol.
Introducing manual protocol selection for 'universal' apps and frameworks.
Diffstat (limited to 'test/test_asgi_application.py')
-rw-r--r--test/test_asgi_application.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/test_asgi_application.py b/test/test_asgi_application.py
index 2e73e529..e90d78bc 100644
--- a/test/test_asgi_application.py
+++ b/test/test_asgi_application.py
@@ -418,3 +418,29 @@ Connection: close
sock.close()
assert len(socks) == len(threads), 'threads differs'
+
+ def test_asgi_application_legacy(self):
+ self.load('legacy')
+
+ resp = self.get(
+ headers={
+ 'Host': 'localhost',
+ 'Content-Length': '0',
+ 'Connection': 'close',
+ },
+ )
+
+ assert resp['status'] == 200, 'status'
+
+ def test_asgi_application_legacy_force(self):
+ self.load('legacy_force', protocol='asgi')
+
+ resp = self.get(
+ headers={
+ 'Host': 'localhost',
+ 'Content-Length': '0',
+ 'Connection': 'close',
+ },
+ )
+
+ assert resp['status'] == 200, 'status'