@faapi/faapi 6.12.0 → 6.13.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.
@@ -752,7 +752,9 @@ type TaskFailedHandler = (info: TaskFailedInfo) => Promise<void> | void;
752
752
  *
753
753
  * 设计要点:
754
754
  * - writer 内部用 ReadableStream + TextEncoder,send 时 enqueue,close 时 close controller
755
- * - response 预设 text/event-stream、no-cache、keep-alive 头,状态码默认 200
755
+ * - response 预设 text/event-stream、no-cache、keep-alive、X-Accel-Buffering: no 头,状态码默认 200
756
+ * (X-Accel-Buffering: no 让 nginx 按响应跳过 proxy_buffering,SSE 小包不被攒到流结束才下发;
757
+ * 非 nginx 反代不识别该头,当普通自定义头透传)
756
758
  * - close 后再 send 静默忽略,避免 handler 异步流程中误写已关闭的流
757
759
  * - sendError 向流写入 event: error 后关闭,用于流式输出中报错的优雅终止
758
760
  *
package/dist/testing.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as FaapiContext, F as FaapiMiddleware, I as InjectorMap, R as RouteManifest, W as WsRouteManifest, C as CorsOptions, H as HelmetOptions } from './routeTypes-m9wZHWyo.js';
1
+ import { a as FaapiContext, F as FaapiMiddleware, I as InjectorMap, R as RouteManifest, W as WsRouteManifest, C as CorsOptions, H as HelmetOptions } from './routeTypes-CVPV8Yd3.js';
2
2
  import { Server } from 'node:http';
3
3
  import { WebSocket } from 'ws';
4
4
 
package/dist/testing.js CHANGED
@@ -123,7 +123,9 @@ function createSseWriter() {
123
123
  headers: {
124
124
  "Content-Type": "text/event-stream",
125
125
  "Cache-Control": "no-cache",
126
- Connection: "keep-alive"
126
+ Connection: "keep-alive",
127
+ // nginx 认到该头后按响应跳过 proxy_buffering;其他反代/客户端忽略,无副作用
128
+ "X-Accel-Buffering": "no"
127
129
  }
128
130
  });
129
131
  const writer = {