@@ -998,7 +998,20 @@ async def __aiter__(self) -> AsyncIterator[bytes]:
998998 assert stream .closed
999999 assert not client .is_closed
10001000
1001- @pytest .mark .parametrize (("method" , "status" ), [("HEAD" , 200 ), ("GET" , 204 ), ("GET" , 205 ), ("GET" , 304 )])
1001+ @pytest .mark .parametrize (
1002+ ("method" , "status" ),
1003+ [
1004+ ("HEAD" , 200 ),
1005+ ("GET" , 100 ),
1006+ ("GET" , 101 ),
1007+ ("GET" , 199 ),
1008+ ("GET" , 204 ),
1009+ ("GET" , 205 ),
1010+ ("GET" , 304 ),
1011+ ("CONNECT" , 200 ),
1012+ ("CONNECT" , 299 ),
1013+ ],
1014+ )
10021015 async def test_empty_bodyless_response_does_not_require_encoded_body (self , method : str , status : int ) -> None :
10031016 stream = _ResponseStream ([])
10041017 response = httpx .Response (status , headers = {"Content-Encoding" : "gzip" }, stream = stream )
@@ -1011,15 +1024,16 @@ async def test_empty_bodyless_response_does_not_require_encoded_body(self, metho
10111024 assert stream .closed
10121025
10131026 @pytest .mark .parametrize ("encoding" , ["gzip" , "deflate" ])
1014- async def test_empty_encoded_get_response_is_rejected (self , encoding : str ) -> None :
1027+ @pytest .mark .parametrize (("method" , "status" ), [("GET" , 200 ), ("CONNECT" , 300 )])
1028+ async def test_empty_encoded_response_with_body_is_rejected (self , encoding : str , method : str , status : int ) -> None :
10151029 stream = _ResponseStream ([])
1016- response = httpx .Response (200 , headers = {"Content-Encoding" : encoding }, stream = stream )
1030+ response = httpx .Response (status , headers = {"Content-Encoding" : encoding }, stream = stream )
10171031 async with (
10181032 httpx .AsyncClient (transport = httpx .MockTransport (lambda request : response )) as client ,
10191033 DefaultHttpRequestHandler (client = client ) as handler ,
10201034 ):
10211035 with pytest .raises (httpx .DecodingError , match = "Incomplete" ):
1022- await handler .send (HttpRequestInfo (method = "GET" , url = "https://api.example.test/items" ))
1036+ await handler .send (HttpRequestInfo (method = method , url = "https://api.example.test/items" ))
10231037 assert stream .closed
10241038
10251039 @pytest .mark .parametrize ("chunk_size" , [1 , 166 ])
0 commit comments