@forklaunch/core 0.15.10 → 0.15.12

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/lib/http/index.js CHANGED
@@ -3574,11 +3574,18 @@ ${res.locals.errorMessage}`;
3574
3574
  originalSend.call(instance, errorString);
3575
3575
  errorSent = true;
3576
3576
  callback(new Error(errorString));
3577
+ } else {
3578
+ let data2 = "";
3579
+ for (const [key, value] of Object.entries(chunk)) {
3580
+ data2 += `${key}: ${typeof value === "string" ? value : (0, import_common12.safeStringify)(value)}
3581
+ `;
3582
+ }
3583
+ data2 += "\n";
3584
+ callback(null, data2);
3577
3585
  }
3578
3586
  });
3579
3587
  firstPass = false;
3580
- }
3581
- if (!errorSent) {
3588
+ } else if (!errorSent) {
3582
3589
  let data2 = "";
3583
3590
  for (const [key, value] of Object.entries(chunk)) {
3584
3591
  data2 += `${key}: ${typeof value === "string" ? value : (0, import_common12.safeStringify)(value)}
@@ -3639,17 +3646,16 @@ ${res.locals.errorMessage}`;
3639
3646
  res.status(500);
3640
3647
  originalSend.call(instance, errorString);
3641
3648
  errorSent = true;
3649
+ } else {
3650
+ if (typeof data === "string") {
3651
+ res.type("text/plain");
3652
+ originalSend.call(instance, data);
3653
+ } else if (!(data instanceof File)) {
3654
+ res.sent = true;
3655
+ originalOperation.call(instance, data);
3656
+ }
3642
3657
  }
3643
3658
  });
3644
- if (!errorSent) {
3645
- if (typeof data === "string") {
3646
- res.type("text/plain");
3647
- originalSend.call(instance, data);
3648
- } else if (!(data instanceof File)) {
3649
- res.sent = true;
3650
- originalOperation.call(instance, data);
3651
- }
3652
- }
3653
3659
  }
3654
3660
  if (shouldEnrich) {
3655
3661
  recordMetric(req, res);