Commit c437b99
authored
Fix query-string: accept array/bracketed keys and trailing & (#586)
* Initial plan
* Fix query-string: accept array/bracketed keys and trailing &
- Replace character-whitelist regex with structural pair validation
- Accept exactly one trailing '&' (backward-compatible)
- Add tests for array-style and bracketed keys (both entry points)
* Parse bracket/array keys into nested dicts and lists
- Add _parse_bracket_notation to convert parse_qs output:
- a[]=1&a[]=2 -> {"a": ["1", "2"]}
- user[name]=joe&user[age]=42 -> {"user": {"name": "joe", "age": "42"}}
- Update tests to use the correct expected results per owner feedback
* Fix mypy type annotations in _parse_bracket_notation
Use dict[str, Any] instead of bare dict for return type and result variable
* Add tests for trailing & and flat=False to cover lines 71 and 74
* Fix flat=False to not create lists for non-bracket keys
* Clarify docstring: flat param does not affect non-bracket keys
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>1 parent f99b35a commit c437b99
2 files changed
Lines changed: 87 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
29 | 58 | | |
30 | 59 | | |
31 | 60 | | |
32 | 61 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
36 | 74 | | |
37 | | - | |
38 | | - | |
39 | | - | |
| 75 | + | |
40 | 76 | | |
41 | 77 | | |
42 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
29 | 74 | | |
30 | 75 | | |
31 | 76 | | |
| |||
0 commit comments