Closed liangxingchen closed 8 years ago
@liangxingchen you need https://github.com/koajs/qs
Alternatively, you can use the qs module yourself in a middleware and put the parsed result on the context's state, i.e. ctx.state.query = qs.parse(ctx.querystring)
. That's what I do in my projects.
If my memory serves me correctly - query parsing is simple by design.
Complexities such as depth can be solved in user land, which as you pointed out: qs
has done.
There's only an implicit spec for nested query strings, which is why it's not in core. If there's ever a real spec then :+1:, until then it's just random semantics that people attempt to derive out of historical use-cases.
Yeah I believe they're working on a real spec for nested query strings. The current semantics is prone to security issues, which is why it isn't included with koa.
the koa-qs works good! thank you all!