Skip to content

Commit

Permalink
Add test for request params behavior changes (encode#3364)
Browse files Browse the repository at this point in the history
---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/GreyElaina/httpx?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
GreyElaina committed Dec 3, 2024
1 parent 15e21e9 commit 91d0f2b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion 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)
* Introduced a behavior change in request parameter handling. (#3364)

## 0.27.2 (27th August, 2024)

Expand Down Expand Up @@ -1090,7 +1091,7 @@ importing modules within the package.
- Disable using `commonName` for hostname checking for OpenSSL 1.1.0+ (Pull #118)
- Detect encoding for `Response.json()` (Pull #116)

## 0.6.7 (July 8, 2019)
## 0.6.7 (July 8, 9, 2019)

- Check for connection aliveness on re-acquisition (Pull #111)

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 91d0f2b

Please sign in to comment.