mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
40c1ec0dec
|
@ -35,7 +35,7 @@ var SwaggerDocs = require("org/arangodb/foxx/swaggerDocs").Docs,
|
||||||
internal = require("org/arangodb/foxx/internals"),
|
internal = require("org/arangodb/foxx/internals"),
|
||||||
toJSONSchema = require("org/arangodb/foxx/schema").toJSONSchema,
|
toJSONSchema = require("org/arangodb/foxx/schema").toJSONSchema,
|
||||||
is = require("org/arangodb/is"),
|
is = require("org/arangodb/is"),
|
||||||
BadRequest = require("http-errors").BadRequest,
|
UnprocessableEntity = require("http-errors").UnprocessableEntity,
|
||||||
UnauthorizedError = require("org/arangodb/foxx/authentication").UnauthorizedError;
|
UnauthorizedError = require("org/arangodb/foxx/authentication").UnauthorizedError;
|
||||||
|
|
||||||
function createBodyParamExtractor(rootElement, paramName, allowInvalid) {
|
function createBodyParamExtractor(rootElement, paramName, allowInvalid) {
|
||||||
|
@ -101,7 +101,7 @@ function validateOrThrow(raw, schema, allowInvalid) {
|
||||||
}
|
}
|
||||||
var result = joi.validate(raw, schema);
|
var result = joi.validate(raw, schema);
|
||||||
if (result.error && !allowInvalid) {
|
if (result.error && !allowInvalid) {
|
||||||
throw new BadRequest(result.error.message.replace(/^"value"/, 'Request body'));
|
throw new UnprocessableEntity(result.error.message.replace(/^"value"/, 'Request body'));
|
||||||
}
|
}
|
||||||
return result.value;
|
return result.value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -982,7 +982,7 @@ function DocumentationAndConstraintsSpec () {
|
||||||
callback(req, res);
|
callback(req, res);
|
||||||
|
|
||||||
assertFalse(called);
|
assertFalse(called);
|
||||||
assertEqual(res.responseCode, 400);
|
assertEqual(res.responseCode, 422);
|
||||||
},
|
},
|
||||||
|
|
||||||
testSetParamForUndocumentedBodyParam: function () {
|
testSetParamForUndocumentedBodyParam: function () {
|
||||||
|
|
Loading…
Reference in New Issue