From 2b327912d5b3f081fa81e3157e3e467a5462044d Mon Sep 17 00:00:00 2001 From: Michael Hackstein Date: Mon, 27 Jan 2014 16:20:32 +0100 Subject: [PATCH] Foxx Controller will now react to int and integer. Furthermore it throws an error if an illegal attribute is defined --- js/server/modules/org/arangodb/foxx/request_context.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/server/modules/org/arangodb/foxx/request_context.js b/js/server/modules/org/arangodb/foxx/request_context.js index 8684173bb4..67ac2ff939 100644 --- a/js/server/modules/org/arangodb/foxx/request_context.js +++ b/js/server/modules/org/arangodb/foxx/request_context.js @@ -142,6 +142,7 @@ RequestContext = function (executionBuffer, models, route) { this.route = route; this.typeToRegex = { "int": "/[0-9]+/", + "integer": "/[0-9]+/", "string": "/.+/" }; @@ -185,6 +186,9 @@ extend(RequestContext.prototype, { constraint = url.constraint || {}; constraint[paramName] = this.typeToRegex[attributes.type]; + if (!constraint[paramName]) { + throw new Error("Illegal attribute type: " + attributes.type); + } this.route.url = internal.constructUrlObject(url.match, constraint, url.methods[0]); this.docs.addPathParam(paramName, attributes.description, attributes.type); return this;