@jaypie/express 1.2.7 → 1.2.8

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/esm/index.js CHANGED
@@ -1259,6 +1259,9 @@ var cors_helper = (config) => {
1259
1259
  else {
1260
1260
  // Fallback for non-CorsError errors
1261
1261
  res.status(HTTP_CODE_NO_CONTENT);
1262
+ if (typeof res.flushHeaders === "function") {
1263
+ res.flushHeaders();
1264
+ }
1262
1265
  res.end();
1263
1266
  }
1264
1267
  return;
@@ -1288,8 +1291,14 @@ var cors_helper = (config) => {
1288
1291
  // Send 204 No Content response and terminate immediately
1289
1292
  // This is critical for Lambda streaming - we must end the response
1290
1293
  // synchronously to prevent the stream from hanging.
1294
+ // CRITICAL: Flush headers first to initialize the Lambda stream wrapper.
1295
+ // Without this, _wrappedStream may be null when _final() is called,
1296
+ // causing the Lambda response stream to never close.
1291
1297
  res.statusCode = HTTP_CODE_NO_CONTENT;
1292
1298
  res.setHeader("Content-Length", "0");
1299
+ if (typeof res.flushHeaders === "function") {
1300
+ res.flushHeaders();
1301
+ }
1293
1302
  res.end();
1294
1303
  });
1295
1304
  return;