@rest-vir/run-service 1.5.2 → 1.6.0
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.
|
@@ -33,8 +33,12 @@ export async function handleEndpointRequest({ endpoint, request, response, attac
|
|
|
33
33
|
searchParams,
|
|
34
34
|
};
|
|
35
35
|
const endpointResult = (await endpoint.implementation(endpointParams));
|
|
36
|
-
/**
|
|
37
|
-
if (
|
|
36
|
+
/** The implementation already handled the response (e.g. SSE streaming). */
|
|
37
|
+
if ('responseHandled' in endpointResult) {
|
|
38
|
+
return undefined;
|
|
39
|
+
/** If the dev forgets to set a status code. */
|
|
40
|
+
}
|
|
41
|
+
else if (!endpointResult.statusCode) {
|
|
38
42
|
throw new RestVirHandlerError(endpoint, 'Missing response status code.');
|
|
39
43
|
}
|
|
40
44
|
else if (isErrorHttpStatus(endpointResult.statusCode)) {
|
|
@@ -33,6 +33,10 @@ export async function handleRoute({ webSocket, request, response, route, attachI
|
|
|
33
33
|
attachId,
|
|
34
34
|
server,
|
|
35
35
|
});
|
|
36
|
+
/** The implementation already handled the response (e.g. SSE streaming). */
|
|
37
|
+
if (response.sent) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
36
40
|
const endpointResult = handleHandlerOutputWithoutSending(result, response);
|
|
37
41
|
const postHookResult = (postHook &&
|
|
38
42
|
endpointResult?.statusCode &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rest-vir/run-service",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Run a service defined by @rest-vir/define-service and implemented by @rest-vir/implement-service.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rest",
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"@augment-vir/node": "^31.68.2",
|
|
45
45
|
"@fastify/compress": "^8.3.1",
|
|
46
46
|
"@fastify/websocket": "^11.2.0",
|
|
47
|
-
"@rest-vir/define-service": "^1.
|
|
48
|
-
"@rest-vir/implement-service": "^1.
|
|
47
|
+
"@rest-vir/define-service": "^1.6.0",
|
|
48
|
+
"@rest-vir/implement-service": "^1.6.0",
|
|
49
49
|
"cluster-vir": "^1.0.1",
|
|
50
50
|
"date-vir": "^8.2.1",
|
|
51
|
-
"fastify": "^5.8.
|
|
51
|
+
"fastify": "^5.8.4",
|
|
52
52
|
"light-my-request": "^6.6.0",
|
|
53
53
|
"portfinder": "^1.0.38",
|
|
54
54
|
"type-fest": "^5.5.0",
|
|
55
|
-
"url-vir": "^2.1.
|
|
55
|
+
"url-vir": "^2.1.8"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@augment-vir/test": "^31.68.2",
|