Commit f2e91cb
committed
fix(query): percent-decode query parameters, and reach repeated keys
Context::query returned the raw slice, so `?q=hello%20world` read back as
"hello%20world" and `?q=a+b` as "a+b". It also split the query string after
lossy-decoding it to text, so an escaped separator inside a value (`%26`, `%3D`)
could still be mistaken for a real one. Repeated keys were unreachable: the first
match returned and there was no way to ask for the rest.
Splitting now happens over the raw bytes and each half is decoded afterwards with
the percent/plus decoder the urlencoded body parser already uses. Context::query_all
returns every value given for a key, in order.
Covered by query_decode_wbtest.mbt (escapes, plus-as-space, escaped separators,
repeated keys, absent keys); mutation-checked in both directions.
Also starts tracking the library's pkg.generated.mbti, which this repo had been
missing while its siblings carry theirs — it is the interface consumers read, and a
diff in it is the signal that a change is externally visible. The examples
regenerate their own, so those stay out of git.
Signed-off-by: Leo Cheng (heke1228) <chengkelfan@qq.com>1 parent e332618 commit f2e91cb
4 files changed
Lines changed: 609 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments