From 3c5c9e55b06d694592ce07b860ec89df5f762b4a Mon Sep 17 00:00:00 2001 From: Matthijs van Henten Date: Wed, 15 Apr 2015 12:03:49 +0000 Subject: [PATCH] default source is now body, simplified thigns --- node_modules/frontdoor/lib/params.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/node_modules/frontdoor/lib/params.js b/node_modules/frontdoor/lib/params.js index bf96b508..944837c2 100644 --- a/node_modules/frontdoor/lib/params.js +++ b/node_modules/frontdoor/lib/params.js @@ -54,13 +54,11 @@ define(function(require, exports, module) { param: function(def, name, source) { var param = def; - source = source || 'url'; - + // Singe edge case for implicit param generation from the url pathparts, // where the pathpart is not defined in params definition. if (typeof def === 'string' && !name) { return { - name: def, source: 'url', optional: false, type: BuiltinTypes.get('string'), @@ -75,18 +73,15 @@ define(function(require, exports, module) { } param.optional = !!param.optional; - param.source = param.source || source; + param.source = param.source || source || "body"; + param.type = param.type || "string"; // allow regular expressions as types if (param.type instanceof RegExp) param.type = new RegExpType(param.type); - if (param.source == "body") - param.type = param.type || "json"; - - param.type = param.type || "string"; - - if (!/^body|url|query$/.test(param.source)) { + + if ( !/^body|url|query$/.test(param.source)) { throw new Error("parameter source muste be 'url', 'query' or 'body'"); }