Skip to content

Commit

Permalink
update requests compatibility docs on query and form params (#2461)
Browse files Browse the repository at this point in the history
  • Loading branch information
falkben committed Nov 25, 2022
1 parent c0e9dba commit 8e5e3b8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ On the other hand, HTTPX uses [HTTPCore](https://github.com/encode/httpcore) as

`requests` omits `params` whose values are `None` (e.g. `requests.get(..., params={"foo": None})`). This is not supported by HTTPX.

For both query params (`params=`) and form data (`data=`), `requests` supports sending a list of tuples (e.g. `requests.get(..., params=[('key1', 'value1'), ('key1', 'value2')])`). This is not supported by HTTPX. Instead, use a dictionary with lists as values. E.g.: `httpx.get(..., params={'key1': ['value1', 'value2']})` or with form data: `httpx.post(..., data={'key1': ['value1', 'value2']})`.

## Event Hooks

`requests` allows event hooks to mutate `Request` and `Response` objects. See [examples](https://requests.readthedocs.io/en/master/user/advanced/#event-hooks) given in the documentation for `requests`.
Expand Down

0 comments on commit 8e5e3b8

Please # to comment.