parameters that belong in the url, but are undefined or null will be considered absent

This commit is contained in:
Spencer Alger
2014-03-31 20:06:49 -07:00
parent ee3bd414a6
commit a363906c4f

View File

@ -129,7 +129,7 @@ function resolveUrl(url, params) {
for (i = 0; i < url.reqParamKeys.length; i ++) {
key = url.reqParamKeys[i];
if (!params.hasOwnProperty(key)) {
if (!params.hasOwnProperty(key) || params[key] == null) {
// missing a required param
return false;
} else {
@ -152,7 +152,7 @@ function resolveUrl(url, params) {
for (i = 0; i < url.optParamKeys.length; i ++) {
key = url.optParamKeys[i];
if (params[key]) {
if (castType[url.opt[key].type]) {
if (castType[url.opt[key].type] || params[key] == null) {
vars[key] = castType[url.opt[key].type](url.opt[key], params[key], key);
} else {
vars[key] = params[key];