@clairejs/server 3.20.0 → 3.20.1
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/README.md
CHANGED
|
@@ -31,20 +31,22 @@ let DefaultHttpRequestHandler = class DefaultHttpRequestHandler extends Abstract
|
|
|
31
31
|
}
|
|
32
32
|
async handleRequest(endpoint, req) {
|
|
33
33
|
//-- supply correct order of params into handler
|
|
34
|
-
const params =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
34
|
+
const params = !endpoint.params
|
|
35
|
+
? [req]
|
|
36
|
+
: Object.values(endpoint.params).map((p) => {
|
|
37
|
+
switch (p.source) {
|
|
38
|
+
case "body":
|
|
39
|
+
return req.getBody();
|
|
40
|
+
case "params":
|
|
41
|
+
return req.getParams();
|
|
42
|
+
case "queries":
|
|
43
|
+
return req.getQuery();
|
|
44
|
+
case "headers":
|
|
45
|
+
return req.headers;
|
|
46
|
+
case "raw":
|
|
47
|
+
return req;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
48
50
|
const response = await endpoint.controller[endpoint.name](...params);
|
|
49
51
|
//-- validate response value against response dto
|
|
50
52
|
if (endpoint.responseDto) {
|