route-parser icon indicating copy to clipboard operation
route-parser copied to clipboard

Query params order

Open mstijak opened this issue 8 years ago • 3 comments

Routes are matched correctly only if query parameters are specified in the right order.

var route = new Route('/?a=:a&b:b');
var result = route.match('/?b=1&a=2');
assert(result);

Would it possible to sort query params when route is parsed and when url is matched to avoid this problem?

mstijak avatar Jun 18 '16 10:06 mstijak

Yeah, this is not the behaviour I would expect from "named parameters".

mschipperheyn avatar Oct 07 '16 21:10 mschipperheyn

👍

peleteiro avatar May 23 '17 15:05 peleteiro

Yeah this is super odd. I also notice if i do

let route = new Route('/users/:id(?foo=:foo)')
route.match('/users/123?foo=lol&rofl=true')
// output: { id: '123', foo: 'lol&rofl=true' }

ashconnell avatar Jun 20 '17 06:06 ashconnell