mirror of https://gitee.com/bigwinds/arangodb
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:
parent
d1d0fb56ba
commit
2b327912d5
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue