Skip to content

perf(json): match json, query and form values by type - #663

Open
patrick-immometrica wants to merge 2 commits into
0x676e67:mainfrom
patrick-immometrica:perf/json-extract
Open

patrick-immometrica wants to merge 2 commits into
0x676e67:mainfrom
patrick-immometrica:perf/json-extract

Conversation

@patrick-immometrica

@patrick-immometrica patrick-immometrica commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Before this commit, a Python value became a JSON or query/form value by trying each variant in turn and keeping the first conversion that worked. Now hand-written FromPyObject impls in src/client/body/json.rs and src/client/param.rs check the Python type first (str, bool, int, float, None, dict, list/tuple) and convert straight to the matching variant, with the old trial chain kept only for other types. A new test in tests/request_test.py sends a body and a query string with every value type to a local server and checks the exact bytes, so the output stays the same.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant