Skip to content

Commit f2e91cb

Browse files
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

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
!.git*
33
_build/
44
target/
5+
6+
# example packages regenerate these; only the library interface is tracked
7+
examples/*/pkg.generated.mbti

0 commit comments

Comments
 (0)