@aeriajs/http 0.0.58 → 0.0.59
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 +1 -1
- package/dist/routing.mjs +8 -8
- package/package.json +5 -5
package/dist/routing.js
CHANGED
|
@@ -129,7 +129,7 @@ const wrapRouteExecution = async (response, cb) => {
|
|
|
129
129
|
response.writeHead(500);
|
|
130
130
|
}
|
|
131
131
|
if (!response.writableEnded) {
|
|
132
|
-
return (0, common_1.
|
|
132
|
+
return (0, common_1.error)({
|
|
133
133
|
httpCode: 500,
|
|
134
134
|
code: 'UNKNOWN_ERROR',
|
|
135
135
|
message: 'Internal server error',
|
package/dist/routing.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { Stream } from "stream";
|
|
3
3
|
import { ACErrors, REQUEST_METHODS } from "@aeriajs/types";
|
|
4
|
-
import { pipe, isGranted, isLeft, deepMerge,
|
|
4
|
+
import { pipe, isGranted, isLeft, deepMerge, error } from "@aeriajs/common";
|
|
5
5
|
import { validate } from "@aeriajs/validation";
|
|
6
6
|
import { getConfig } from "@aeriajs/entrypoint";
|
|
7
7
|
import { safeJson } from "./payload.mjs";
|
|
@@ -76,18 +76,18 @@ export const registerRoute = async (context, method, exp, cb, contract, options
|
|
|
76
76
|
}
|
|
77
77
|
if ("payload" in contract && contract.payload) {
|
|
78
78
|
const validationEither = validate(context.request.payload, contract.payload);
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
return
|
|
79
|
+
const error2 = checkUnprocessable(validationEither, context);
|
|
80
|
+
if (error2) {
|
|
81
|
+
return error2;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
if ("query" in contract && contract.query) {
|
|
85
85
|
const validationEither = validate(context.request.query, contract.query, {
|
|
86
86
|
coerce: true
|
|
87
87
|
});
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
return
|
|
88
|
+
const error2 = checkUnprocessable(validationEither, context);
|
|
89
|
+
if (error2) {
|
|
90
|
+
return error2;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -122,7 +122,7 @@ export const wrapRouteExecution = async (response, cb) => {
|
|
|
122
122
|
response.writeHead(500);
|
|
123
123
|
}
|
|
124
124
|
if (!response.writableEnded) {
|
|
125
|
-
return
|
|
125
|
+
return error({
|
|
126
126
|
httpCode: 500,
|
|
127
127
|
code: "UNKNOWN_ERROR",
|
|
128
128
|
message: "Internal server error"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/http",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.59",
|
|
4
4
|
"description": "## Installation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"@aeriajs/validation": "link:../validation"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@aeriajs/common": "^0.0.
|
|
32
|
-
"@aeriajs/entrypoint": "^0.0.
|
|
33
|
-
"@aeriajs/types": "^0.0.
|
|
34
|
-
"@aeriajs/validation": "^0.0.
|
|
31
|
+
"@aeriajs/common": "^0.0.51",
|
|
32
|
+
"@aeriajs/entrypoint": "^0.0.51",
|
|
33
|
+
"@aeriajs/types": "^0.0.48",
|
|
34
|
+
"@aeriajs/validation": "^0.0.54"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"test": "echo skipping",
|