]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Enhance test coverage for httpx requests
authorKim Christie <kim@encode.io>
Wed, 17 Dec 2025 12:52:50 +0000 (12:52 +0000)
committerGitHub <noreply@github.com>
Wed, 17 Dec 2025 12:52:50 +0000 (12:52 +0000)
Add tests for invalid request schemes and missing host.

tests/test_request.py

index a69e1d13586d36c0fcf2485af738dc8d4830826f..cab0a5e109ad464ef4ca3a77e2b8d04f58c181af 100644 (file)
@@ -1,4 +1,5 @@
 import httpx
+import pytest
 
 
 class ByteIterator:
@@ -77,3 +78,13 @@ def test_request_empty_post():
         "Content-Length": "0",
     }
     assert r.read() == b''
+
+
+def test_request_invalid_scheme():
+    with pytest.raises(ValueError):
+        httpx.Request("GET", "ws://example.com")
+
+
+def test_request_missing_host():
+    with pytest.raises(ValueError):
+        r = httpx.Request("GET", "https:/example.com")