From 56cc620bc277add138e3c6e8f3920be04b3aff00 Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Fri, 6 Oct 2023 14:52:53 -0400 Subject: [PATCH] Handle `"client": None` in WsgiToAsgi adapter (#411) --- asgiref/wsgi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asgiref/wsgi.py b/asgiref/wsgi.py index 40fba205..bf1be604 100644 --- a/asgiref/wsgi.py +++ b/asgiref/wsgi.py @@ -76,7 +76,7 @@ def build_environ(self, scope, body): environ["SERVER_NAME"] = "localhost" environ["SERVER_PORT"] = "80" - if "client" in scope: + if scope.get("client") is not None: environ["REMOTE_ADDR"] = scope["client"][0] # Go through headers and make them into environ entries