Repository navigation
Client: URL-encode the query parameters - #2444
Merged
ml-evs merged 3 commits intoOct 25, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2444 +/- ##
=======================================
Coverage 90.21% 90.21%
=======================================
Files 78 78
Lines 5037 5039 +2
=======================================
+ Hits 4544 4546 +2
Misses 493 493
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ml-evs
enabled auto-merge (squash)
October 25, 2026 21:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2443.
OptimadeClient._build_urlput the query parameter values into the URL as they are, so+,&and#in a filter kept their URL meaning (space, parameter separator, fragment) and the server received a different filter. The spec asks the client to URL-encode thefilterparameter ("URL Encoding"; "Filtering": "the contents of the filter parameter is URL-encoded by the client").Changes
_build_urlpercent-encodes the values offilter,response_fields,sortandother_paramswithurllib.parse.quote(..., safe=","). Commas are kept, as they separate list values (response_fields=id,elements). Thenextlinks from the servers are not changed.tests/server/test_client.py:test_client_url_encoding:_build_urlwithchemical_formula_descriptive = "A+B&C#D"and a+response field decodes back (parse_qs) to exactly the same values;test_client_awkward_nested_provider_field(sync and async): filters on_exmpl_stability.gga_gga+u_r2scan < 0through the client against the test server and expectsmpf_3819, the same field and result as the server testtest_awkward_nested_provider_fieldadded in Use 1.2 grammar by default and relax rules on nested fields #2242 (which sends%2Bby hand). Without the encoding the server answers 400. Markedxfailon Elasticsearch, like the server test, since that backend does not support nested provider fields.Tests
pytest tests/server/test_client.py: 140 passed; both new tests fail without the change.python3.10, whichdefault_language_versionpins ("failed to find interpreter for Builtin discover of python_spec='python3.10'"); the same hooks pass in the GitHub Actionspre-commitjob.pre-commit runon the two files: all hooks pass.