Query string parsing doesn't work with push state disabled?
nicolashery opened this issue · comments
Given this code:
var Handler = {
index: function(req) {
console.log(req);
}
};
Aviator.pushStateEnabled = false;
Aviator.setRoutes({
'/users': {
target: Handler,
'/': 'index',
'/:id': 'index'
}
});
Aviator.dispatch();
Aviator.navigate('/users/123?foo=bar');
I get a Request object with queryParams
empty and queryString
null?
If I comment out the line Aviator.pushStateEnabled = false
though, I get the expected Request object, with the query string parsed properly.
I was testing this in Chrome 34. Any ideas what's going on?
Thanks!
Thats unfortunate. I'll get right on that! Thanks for creating this issue :)
Thanks!
I also bumped into the following "corner case", might be related...
Given this code:
var Handler = {
index: function(req) {
console.log(req);
}
};
Aviator.pushStateEnabled = false;
Aviator.setRoutes({
'/users': {
target: Handler,
'/': 'index'
},
'/cats/:id': {
target: Handler,
'/': 'index'
}
});
Aviator.dispatch();
Aviator.navigate('/users?foo=bar');
I get a Uncaught TypeError: Cannot read property 'indexOf' of undefined (aviator.js:898)
.
But if I comment out the pushStateEnabled = false
, it works as expected.
@nicolashery that seems unrelated, but definitely a bug with hash routing. Could you create another issue for that one? Thanks
Done in #57
That could very much be #57.
Also don't apologize :) You're helping make Aviator more awesome! Thank you.
@nicolashery I tagged v0.4.1 with the 2 fixes :)
@hojberg Wonderful. Thanks again for quickly fixing this!