millermedeiros / crossroads.js

JavaScript Routes
http://millermedeiros.github.com/crossroads.js/
1.44k stars 156 forks source link

Query strings do not respect the `shouldTypecast` property #71

Closed bramstein closed 12 years ago

bramstein commented 12 years ago

This patch changes the decoding of query strings to respect the global shouldTypecast property.

I could tell from your unit tests that typecasting the query string values was intentional, but I feel this is a bit unexpected when I explicitly set the shouldTypecast property to false. For this reason I'm hoping you will consider accepting this patch which makes the behaviour consistent.

I've updated all the unit tests that test the typecasting of query strings and added a new one that tests that typecasting is not performed by default. All tests pass after these changes.

millermedeiros commented 12 years ago

I agree that it should respect the shouldTypecast. The change in behavior will probably break some apps but I guess it's better to change it sooner than later.

Was considering to add another setting but I guess this should be enough for most cases, so let's keep like this. I added this change to the v0.11.0 milestone, should be on the next release.

millermedeiros commented 12 years ago

I merged this into dev including other changes that I hope to ship with v0.11.0: https://github.com/millermedeiros/crossroads.js/compare/v0.10.0...v0.11.0a - it would be great to get feedback on the v0.11.0 changes. Thanks.

bramstein commented 12 years ago

The changes look good. I've tried out the dev branch (v0.11.0) and couldn't find any problems with in my app.