Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
[Bug 5445839] route params as object instead of
Browse files Browse the repository at this point in the history
query string. Patch converted string to object in
the wrong place (throws on every request). Mis-
leading code in mojito-router.js removed, fix was
applied to route-maker.common.js
  • Loading branch information
Isao Yagi committed Apr 24, 2012
1 parent be49adb commit 89fffae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion source/lib/app/autoload/route-maker.common.js
Expand Up @@ -135,7 +135,9 @@ YUI.add('mojito-route-maker', function(Y, NAME) {
}
}

route.params = Y.QueryString.parse(route.params);
if (typeof route.params !== 'object') {
route.params = Y.QueryString.parse(String(route.params));
}

build = [];
for (i in route.requires) {
Expand Down
10 changes: 6 additions & 4 deletions source/lib/app/middleware/mojito-router.js
Expand Up @@ -8,8 +8,7 @@
/*jslint anon:true, sloppy:true, nomen:true*/


var qs = require('querystring'),
logger,
var logger,
liburl = require('url'),
RX_END_SLASHES = /\/+$/,
NAME = 'UriRouter';
Expand Down Expand Up @@ -99,9 +98,12 @@ Router.prototype = {
// of instance
// command.action = routeMatch.call[1];
command.context = req.context;

//routeMatch.param is converted to object in route-maker.common.js
//and is never a string here. i.e. this assert always passes:
//require('assert').ok(typeof routeMatch.param !== 'string');
command.params = {
route: simpleMerge(routeMatch.query,
qs.parse(routeMatch.param)),
route: simpleMerge(routeMatch.query, routeMatch.param),
url: query || {},
body: req.body || {},
file: {} // FUTURE: add multi-part file data here
Expand Down

1 comment on commit 89fffae

@isao
Copy link
Contributor

@isao isao commented on 89fffae Apr 24, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Brad

Please sign in to comment.