Change QueryParams(key=None) to not emit a parameter
See original GitHub issueThis one I know is requests
behaviour:
Take a dict:
>>> from httpx import QueryParams
>>> params = {"thing_one": 1, "thing_two": [1,2,3], "thing_three": None}
>>> QueryParams(params)
QueryParams('thing_one=1&thing_two=%5B1%2C+2%2C+3%5D&thing_three=None')
Expected:
QueryParams('thing_one=1&thing_two=%5B1%2C+2%2C+3%5D')
Adding if v is not None
here will do it.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Angular: How to update queryParams without changing route
You can navigate to the current route with new query params, which will not reload your page, but will update query params. Something...
Read more >Validate Query Parameters and Headers Using APIkit
Validate Query Parameters and Headers Using APIkit · In your Studio canvas, select APIkit Router. · Select the Edit button for your router...
Read more >Power BI October 2020 Feature Summary
This new Microsoft Power BI feature allows M Query Parameters to be ... Note that if the mapped column is set to No...
Read more >Prometheus data source | Grafana documentation
Set the data source's basic configuration options carefully: ... Custom query parameters, Adds custom parameters to the Prometheus query URL, ...
Read more >RestEase.SourceGenerator 1.6.1 - NuGet
Formatting Variable Query Parameters; Serialization of Variable Query Parameters ... ISomeApi { [Header("X-API-Key", "None")] string ApiKey { get; set; } ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since I’m no longer on mobile and can type symbols easily I’m proposing:
{"q": "1"}
->?q=1
{"q": ""}
->?q=
{"q": None}
->?q
There are also instances where the order matters for the parameters, so maybe we need to allow
typing.Iterable[typing.Tuple[typing.AnyStr, typing.AnyStr]]
in addition to dict?I’m using Pydantic to roundtrip my params and standardize on values with custom validators/parsers: https://pydantic-docs.helpmanual.io/#json-serialisation so I’m sure some inspiration could be taken from that.
I would not be opposed to the latter, especially since query params can imitate form data, they should also allow lists, and explode them since QueryParams is already a multi-dict. This however could be left up to the user.