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