Repository navigation
single list query params convert just string #2857
Unanswered
lhs950204-eoding
asked this question in
Q&A
Replies: 1 comment
|
This is expected. A Python list passed through str(httpx.QueryParams({"a": [1, 2], "b": 2}))
# 'a=1&a=2&b=2'A one-element list therefore produces If the API specifically requires the textual JSON value import json
response = httpx.get(url, params={"a": json.dumps([1]), "b": 2})
# a=%5B1%5D&b=2; the decoded value of a is '[1]'If you control a FastAPI server and want repeated values, declare the field as a query list, for example Checked the repeated-key and JSON-string encodings on HTTPX 0.28.1. Which representation to use depends on the receiving API's contract. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
hi, i have some question.
i make request like this
and i predict query string like this
http://test.com?a=1&b=2
``
this is bug...? or am i stupid...? please help
All reactions