Comparing version 1.0.14 to 1.0.15
@@ -14,23 +14,23 @@ "use strict"; | ||
return async (req, res, next) => { | ||
const route = serverRoutes[req.path]; | ||
if (!route) | ||
return next(); | ||
if (!route.filesConfig) | ||
req.body = await (0, bodyJSON_1.getJSONDataFromRequestStream)(req); | ||
let validation = {}; | ||
if (route.validator) | ||
validation = await route.validator.validate(req, {}); | ||
if (validation.error) { | ||
onError?.({ | ||
error: validation.error, | ||
path: req.path, | ||
req, | ||
headers: req.headers, | ||
body: req.body, | ||
query: req.query, | ||
}); | ||
return res.status(validation.error.status || 500).json({ error: validation.error }); | ||
} | ||
let result; | ||
try { | ||
const route = serverRoutes[req.path]; | ||
if (!route) | ||
return next(); | ||
if (!route.filesConfig) | ||
req.body = await (0, bodyJSON_1.getJSONDataFromRequestStream)(req); | ||
if (route.validator) | ||
validation = await route.validator.validate(req, {}); | ||
if (validation.error) { | ||
onError?.({ | ||
error: validation.error, | ||
path: req.path, | ||
req, | ||
headers: req.headers, | ||
body: req.body, | ||
query: req.query, | ||
}); | ||
return res.status(validation.error.status || 500).json({ error: validation.error }); | ||
} | ||
let result; | ||
if (route.filesConfig) { | ||
@@ -37,0 +37,0 @@ const form = (0, formidable_1.default)({ multiples: true }); |
{ | ||
"name": "bridgets", | ||
"version": "1.0.14", | ||
"version": "1.0.15", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/Lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
87110