Skip to content

Commit

Permalink
Add test for request params behavior changes (#3364) (#3440)
Browse files Browse the repository at this point in the history
Co-authored-by: Tom Christie <tom@tomchristie.com>
  • Loading branch information
GreyElaina and tomchristie authored Dec 3, 2024
1 parent 0cb7e5a commit 8ecb86f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Our revised [SSL documentation](docs/advanced/ssl.md) covers how to implement th
* Ensure `certifi` and `httpcore` are only imported if required. (#3377)
* Treat `socks5h` as a valid proxy scheme. (#3178)
* Cleanup `Request()` method signature in line with `client.request()` and `httpx.request()`. (#3378)
* Bugfix: When passing `params={}`, always strictly update rather than merge with an existing querystring. (#3364)

## 0.27.2 (27th August, 2024)

Expand Down
13 changes: 13 additions & 0 deletions tests/models/test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,16 @@ def content() -> typing.Iterator[bytes]:
request.read()
pickle_request = pickle.loads(pickle.dumps(request))
assert pickle_request.content == b"test 123"


def test_request_params():
request = httpx.Request("GET", "http://example.com", params={})
assert str(request.url) == "http://example.com"

request = httpx.Request(
"GET", "http://example.com?c=3", params={"a": "1", "b": "2"}
)
assert str(request.url) == "http://example.com?a=1&b=2"

request = httpx.Request("GET", "http://example.com?a=1", params={})
assert str(request.url) == "http://example.com"

0 comments on commit 8ecb86f

Please sign in to comment.