@aeriajs/http 0.0.201 → 0.0.203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/routing.js +11 -6
- package/package.json +7 -7
package/dist/routing.js
CHANGED
|
@@ -35,13 +35,17 @@ const checkUnprocessable = async (what, schema, context, validateOptions = {}) =
|
|
|
35
35
|
return Result.result(validated);
|
|
36
36
|
};
|
|
37
37
|
export const matches = (req, method, exp, options = {}, config) => {
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
let base;
|
|
39
|
+
if (config?.baseUrl && config.baseUrl !== '/') {
|
|
40
|
+
base = options.base
|
|
40
41
|
? `${config.baseUrl}${options.base}`
|
|
41
|
-
: config.baseUrl
|
|
42
|
-
|
|
42
|
+
: config.baseUrl;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
base = options.base
|
|
43
46
|
? options.base
|
|
44
47
|
: '';
|
|
48
|
+
}
|
|
45
49
|
if (method && method !== req.method) {
|
|
46
50
|
if (!Array.isArray(method) || !method.includes(req.method)) {
|
|
47
51
|
return;
|
|
@@ -132,6 +136,7 @@ export const wrapRouteExecution = async (response, cb) => {
|
|
|
132
136
|
result.pipe(response);
|
|
133
137
|
}
|
|
134
138
|
catch (err) {
|
|
139
|
+
console.trace(err);
|
|
135
140
|
}
|
|
136
141
|
return;
|
|
137
142
|
}
|
|
@@ -147,8 +152,8 @@ export const wrapRouteExecution = async (response, cb) => {
|
|
|
147
152
|
}
|
|
148
153
|
return result;
|
|
149
154
|
}
|
|
150
|
-
catch (
|
|
151
|
-
console.trace(
|
|
155
|
+
catch (err) {
|
|
156
|
+
console.trace(err);
|
|
152
157
|
if (!response.headersSent) {
|
|
153
158
|
response.writeHead(HTTPStatus.InternalServerError);
|
|
154
159
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/http",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.203",
|
|
5
5
|
"description": "## Installation",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"aeriaMain": "tests/fixtures/aeriaMain.js",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"@aeriajs/entrypoint": "link:../entrypoint",
|
|
27
27
|
"@aeriajs/types": "link:../types",
|
|
28
28
|
"@aeriajs/validation": "link:../validation",
|
|
29
|
-
"mongodb": "^
|
|
29
|
+
"mongodb": "^7.0.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@aeriajs/common": "^0.0.
|
|
33
|
-
"@aeriajs/entrypoint": "^0.0.
|
|
34
|
-
"@aeriajs/types": "^0.0.
|
|
35
|
-
"@aeriajs/validation": "^0.0.
|
|
36
|
-
"mongodb": "^
|
|
32
|
+
"@aeriajs/common": "^0.0.164",
|
|
33
|
+
"@aeriajs/entrypoint": "^0.0.172",
|
|
34
|
+
"@aeriajs/types": "^0.0.139",
|
|
35
|
+
"@aeriajs/validation": "^0.0.188",
|
|
36
|
+
"mongodb": "^7.0.0"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"test": "vitest run",
|