From 938f72ae601eb34b47261a53ea52bc96834a398c Mon Sep 17 00:00:00 2001 From: Marco Paolini Date: Thu, 30 Jul 2020 01:25:15 +0200 Subject: [PATCH] Fix crash when --interface is wsgi This is a regression introduced in ae0fd316f03dbef926e40216024dfb934417d48d (#597) --- tests/test_config.py | 1 + uvicorn/config.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_config.py b/tests/test_config.py index c1f763b41..39b9e7960 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -31,6 +31,7 @@ def test_wsgi_app(): assert isinstance(config.loaded_app, WSGIMiddleware) assert config.interface == "wsgi" + assert config.asgi_version == "2.0" def test_proxy_headers(): diff --git a/uvicorn/config.py b/uvicorn/config.py index fa17cae03..e50c6f8bf 100644 --- a/uvicorn/config.py +++ b/uvicorn/config.py @@ -202,7 +202,7 @@ def __init__( @property def asgi_version(self) -> str: - return {"asgi2": "2.0", "asgi3": "3.0"}[self.interface] + return {"asgi2": "2.0", "asgi3": "3.0", "wsgi": "2.0"}[self.interface] @property def is_ssl(self) -> bool: