mirror of
https://github.com/usestrix/strix.git
synced 2026-10-08 03:08:08 +00:00
fix(proxy): encode multi-value param overrides as repeated pairs
This commit is contained in:
parent
680e821226
commit
711a352c5f
2 changed files with 14 additions and 1 deletions
|
|
@ -261,7 +261,7 @@ def apply_modifications(
|
|||
if key not in overrides
|
||||
]
|
||||
pairs.extend(overrides.items())
|
||||
final_url = urlunparse(parsed._replace(query=urlencode(pairs)))
|
||||
final_url = urlunparse(parsed._replace(query=urlencode(pairs, doseq=True)))
|
||||
if "headers" in modifications:
|
||||
headers.update(modifications["headers"])
|
||||
if "body" in modifications:
|
||||
|
|
|
|||
|
|
@ -67,3 +67,16 @@ def test_params_add_new_param() -> None:
|
|||
pairs = _query_pairs(result["url"])
|
||||
assert ("a", "1") in pairs
|
||||
assert ("new", "1") in pairs
|
||||
|
||||
|
||||
def test_params_override_with_multiple_values() -> None:
|
||||
result = apply_modifications(
|
||||
_components(),
|
||||
{"params": {"tag": ["a", "b"]}},
|
||||
"http://victim.com/search?tag=old&q=x",
|
||||
)
|
||||
pairs = _query_pairs(result["url"])
|
||||
assert ("tag", "a") in pairs
|
||||
assert ("tag", "b") in pairs
|
||||
assert ("tag", "old") not in pairs
|
||||
assert ("q", "x") in pairs
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue