kb-server 0.0.2 → 0.0.3
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.
|
@@ -41,7 +41,7 @@ function createServer(params, options) {
|
|
|
41
41
|
// 使用自定义中间件
|
|
42
42
|
middlewares.forEach((middleware) => app.use(middleware));
|
|
43
43
|
// 注入SSE
|
|
44
|
-
handlers && app.use((0, sse_middleware_1.packSSE)(handlers, { log, ...resetSSE }));
|
|
44
|
+
handlers && app.use((0, sse_middleware_1.packSSE)(handlers, { authFn, log, ...resetSSE }));
|
|
45
45
|
// 注入API
|
|
46
46
|
app.use((0, api_middleware_1.packAPI)(apis, { authFn, log }));
|
|
47
47
|
return app;
|
|
@@ -148,10 +148,7 @@ const packSSE = (sseHandlers, options) => {
|
|
|
148
148
|
},
|
|
149
149
|
};
|
|
150
150
|
const response = (0, exports.createSSEMsg)("error", JSON.stringify(errResponse));
|
|
151
|
-
// 完成响应
|
|
152
|
-
took = Date.now() - start;
|
|
153
151
|
logger_1.logger.info(`发送消息:\n${response}`);
|
|
154
|
-
logger_1.logger.info(`耗时:${took} ms - ${requestId}`);
|
|
155
152
|
res.write(response, () => res.end());
|
|
156
153
|
}
|
|
157
154
|
};
|