Skip to content

Preserve encoded query parameters in recorded requests - #330

Merged
mindflayer merged 3 commits into
mindflayer:mainfrom
bensynapse:fix-querystring-decoding
Oct 5, 2026
Merged

mindflayer merged 3 commits into
mindflayer:mainfrom
bensynapse:fix-querystring-decoding

Conversation

@bensynapse

@bensynapse bensynapse commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

I run Live Tennis API.

A recorded request with q=a%2Bb%26c reports two fields, q="a b" and c="". It should report q="a+b&c".
Request.querystring now passes the raw query to parse_qs, which decodes each field once. This also preserves encoded parameter names and literal percent escapes.

The fourteen new cases use requests. They cover encoded parameters, repeated and empty values, and recorded HTTP and HTTPS requests. Eight regressions fail before the fix.

Docker make test passes 252 tests and the separate pook test. Two tests are expected failures, and one is an expected failure that passes.
make safetest passes 232 tests on Python 3.14. make types and the changed file's pre-commit hooks pass.
Existing response close and dependency warnings remain.

Fixes #331.

Comment thread tests/test_http.py Outdated
@mindflayer

Copy link
Copy Markdown
Owner

Hi @bensynapse, ideally you should have opened an issue first. Could you please do that and link this PR as the fix for it?

@bensynapse

Copy link
Copy Markdown
Contributor Author

I switched the new tests in tests/test_http.py to requests and kept the encoded parameter cases.
I opened issue #331 and linked this PR as its fix.
Docker make test passes 252 tests plus the separate pook test.

Comment thread tests/test_http.py Outdated
@bensynapse

Copy link
Copy Markdown
Contributor Author

I renamed it to test_request_querystring_uses_form_urlencoded_semantics in 60ffc9f.
Docker make test passes 252 tests plus the separate pook test.

@sonarqubecloud

sonarqubecloud Bot commented Oct 5, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.85%. Comparing base (3641550) to head (60ffc9f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #330   +/-   ##
=======================================
  Coverage   98.85%   98.85%           
=======================================
  Files          22       22           
  Lines        1224     1224           
=======================================
  Hits         1210     1210           
  Misses         14       14           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mindflayer
mindflayer merged commit 7fcbb74 into mindflayer:main Oct 5, 2026
12 checks passed
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.

Recorded query parameters decode escaped separators twice

2 participants