File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ def handle_request(self, request: Request) -> Response:
102102 "QUERY_STRING" : request .url .query .decode ("ascii" ),
103103 "SERVER_NAME" : request .url .host ,
104104 "SERVER_PORT" : str (port ),
105+ "SERVER_PROTOCOL" : "HTTP/1.1" ,
105106 "REMOTE_ADDR" : self .remote_addr ,
106107 }
107108 for header_key , header_value in request .headers .raw :
Original file line number Diff line number Diff line change @@ -173,3 +173,20 @@ def app(environ, start_response):
173173 assert response .status_code == 200
174174 assert response .text == "Hello, World!"
175175 assert server_port == expected_server_port
176+
177+
178+ def test_wsgi_server_protocol ():
179+ server_protocol = None
180+
181+ def app (environ , start_response ):
182+ nonlocal server_protocol
183+ server_protocol = environ ["SERVER_PROTOCOL" ]
184+ start_response ("200 OK" , [("Content-Type" , "text/plain" )])
185+ return [b"success" ]
186+
187+ with httpx .Client (app = app , base_url = "http://testserver" ) as client :
188+ response = client .get ("/" )
189+
190+ assert response .status_code == 200
191+ assert response .text == "success"
192+ assert server_protocol == "HTTP/1.1"
You can’t perform that action at this time.
0 commit comments