Skip to content

Commit 39db171

Browse files
Enhance test coverage for httpx requests
Add tests for invalid request schemes and missing host.
1 parent ae25e86 commit 39db171

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/test_request.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import httpx
2+
import pytest
23

34

45
class ByteIterator:
@@ -77,3 +78,13 @@ def test_request_empty_post():
7778
"Content-Length": "0",
7879
}
7980
assert r.read() == b''
81+
82+
83+
def test_request_invalid_scheme():
84+
with pytest.raises(ValueError):
85+
httpx.Request("GET", "ws://example.com")
86+
87+
88+
def test_request_missing_host():
89+
with pytest.raises(ValueError):
90+
r = httpx.Request("GET", "https:/example.com")

0 commit comments

Comments
 (0)