1
0
Fork 0

Foxx Controller will now react to int and integer. Furthermore it throws an error if an illegal attribute is defined

This commit is contained in:
Michael Hackstein 2014-01-27 16:20:32 +01:00
parent d1d0fb56ba
commit 2b327912d5
1 changed files with 4 additions and 0 deletions

View File

@ -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;