Skip to content

Commit 81c15ef

Browse files
committed
httpserver: follow-up werkzeug's header type change
1 parent 209567f commit 81c15ef

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

pytest_httpserver/httpserver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
METHOD_ALL = "__ALL"
3535

3636
HEADERS_T = Union[
37-
Mapping[str, Union[str, int, Iterable[Union[str, int]]]],
38-
Iterable[Tuple[str, Union[str, int]]],
37+
Mapping[str, Union[str, Iterable[str]]],
38+
Iterable[Tuple[str, str]],
3939
]
4040

4141
HVMATCHER_T = Callable[[str, Optional[str], str], bool]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
upgrade:
3+
- With werkzeug 2.3.x the headers type has been updated to not allow integers
4+
as header values. This restriction followed up in pytest-httpserver.

tests/test_headers.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,14 @@ def test_authorization_headers(httpserver: HTTPServer):
8282
def test_header_one_key_multiple_values(httpserver: HTTPServer):
8383
httpserver.expect_request(uri="/t1").respond_with_data(headers=[("X-Foo", "123"), ("X-Foo", "456")])
8484
httpserver.expect_request(uri="/t2").respond_with_data(headers={"X-Foo": ["123", "456"]})
85-
httpserver.expect_request(uri="/t3").respond_with_data(headers={"X-Foo": [123, 456]})
8685

8786
headers = Headers()
8887
headers.add("X-Foo", "123")
8988
headers.add("X-Foo", "456")
9089

91-
httpserver.expect_request(uri="/t4").respond_with_data(headers=headers)
90+
httpserver.expect_request(uri="/t3").respond_with_data(headers=headers)
9291

93-
for uri in ("/t1", "/t2", "/t3", "/t4"):
92+
for uri in ("/t1", "/t2", "/t3"):
9493
conn = http.client.HTTPConnection("localhost:{}".format(httpserver.port))
9594
conn.request("GET", uri)
9695
response = conn.getresponse()

0 commit comments

Comments
 (0)