Skip to content

Allow lists in query params - #386

Merged
sethmlarson merged 1 commit into
masterfrom
feat/query-params-list
Oct 8, 2019
Merged

sethmlarson merged 1 commit into
masterfrom
feat/query-params-list

Conversation

@florimondmanca

Copy link
Copy Markdown
Contributor

Fixes #366

Re-running the example from #366 (comment):

import httpx
import requests

URL = "https://httpbin.org/get"
PARAMS = {"documentIds": ["a55b2f894b90dd1213201471_25", "b54b2f894b90dd1213201471_9"]}

resp = requests.get(URL, params=PARAMS)
print("requests", resp.json()["args"])

r = httpx.get(URL, params=PARAMS)
json = r.json()
assert isinstance(json, dict)
print("httpx", json["args"])

print("httpx", str(httpx.QueryParams(PARAMS)))
requests {'documentIds': ['a55b2f894b90dd1213201471_25', 'b54b2f894b90dd1213201471_9']}
httpx {'documentIds': ['a55b2f894b90dd1213201471_25', 'b54b2f894b90dd1213201471_9']}
httpx documentIds=a55b2f894b90dd1213201471_25&documentIds=b54b2f894b90dd1213201471_9

Comment thread httpx/utils.py Resolved
sethmlarson
sethmlarson previously approved these changes Sep 25, 2019
Comment thread httpx/models.py Resolved
Comment thread httpx/utils.py Resolved
@florimondmanca

Copy link
Copy Markdown
Contributor Author

@tomchristie @sethmlarson Ready for re-review! :-)

@florimondmanca
florimondmanca force-pushed the feat/query-params-list branch from 8878d26 to da903ce Compare October 8, 2019 19:56
@sethmlarson
sethmlarson merged commit 57ae7ea into master Oct 8, 2019
@sethmlarson
sethmlarson deleted the feat/query-params-list branch October 8, 2019 20:12
@sethmlarson

Copy link
Copy Markdown
Contributor

This is a great change, thanks @florimondmanca! :)

Kludex referenced this pull request in pydantic/httpx2 May 11, 2026
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Query params should support list-of-strings values.

3 participants