@jaypie/express 1.2.4-rc12 → 1.2.4-rc13

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.
@@ -30,6 +30,7 @@ export declare class LambdaResponseBuffered extends Writable {
30
30
  /**
31
31
  * Proxy for direct header access (e.g., res.headers['content-type']).
32
32
  * Required for compatibility with middleware like helmet that access headers directly.
33
+ * Uses direct _headers access to bypass dd-trace interception.
33
34
  */
34
35
  get headers(): Record<string, string | string[] | undefined>;
35
36
  writeHead(statusCode: number, statusMessageOrHeaders?: OutgoingHttpHeaders | string, headers?: OutgoingHttpHeaders): this;
@@ -30,6 +30,7 @@ export declare class LambdaResponseStreaming extends Writable {
30
30
  /**
31
31
  * Proxy for direct header access (e.g., res.headers['content-type']).
32
32
  * Required for compatibility with middleware like helmet that access headers directly.
33
+ * Uses direct _headers access to bypass dd-trace interception.
33
34
  */
34
35
  get headers(): Record<string, string | string[] | undefined>;
35
36
  writeHead(statusCode: number, statusMessageOrHeaders?: OutgoingHttpHeaders | string, headers?: OutgoingHttpHeaders): this;
@@ -303,36 +303,40 @@ class LambdaResponseBuffered extends node_stream.Writable {
303
303
  /**
304
304
  * Proxy for direct header access (e.g., res.headers['content-type']).
305
305
  * Required for compatibility with middleware like helmet that access headers directly.
306
+ * Uses direct _headers access to bypass dd-trace interception.
306
307
  */
307
308
  get headers() {
308
309
  return new Proxy({}, {
309
310
  deleteProperty: (_target, prop) => {
310
- this.removeHeader(String(prop));
311
+ this._headers.delete(String(prop).toLowerCase());
311
312
  return true;
312
313
  },
313
314
  get: (_target, prop) => {
314
315
  if (typeof prop === "symbol")
315
316
  return undefined;
316
- return this.getHeader(String(prop));
317
+ return this._headers.get(String(prop).toLowerCase());
317
318
  },
318
319
  getOwnPropertyDescriptor: (_target, prop) => {
319
- if (this.hasHeader(String(prop))) {
320
+ const lowerProp = String(prop).toLowerCase();
321
+ if (this._headers.has(lowerProp)) {
320
322
  return {
321
323
  configurable: true,
322
324
  enumerable: true,
323
- value: this.getHeader(String(prop)),
325
+ value: this._headers.get(lowerProp),
324
326
  };
325
327
  }
326
328
  return undefined;
327
329
  },
328
330
  has: (_target, prop) => {
329
- return this.hasHeader(String(prop));
331
+ return this._headers.has(String(prop).toLowerCase());
330
332
  },
331
333
  ownKeys: () => {
332
- return this.getHeaderNames();
334
+ return Array.from(this._headers.keys());
333
335
  },
334
336
  set: (_target, prop, value) => {
335
- this.setHeader(String(prop), value);
337
+ if (!this._headersSent) {
338
+ this._headers.set(String(prop).toLowerCase(), value);
339
+ }
336
340
  return true;
337
341
  },
338
342
  });
@@ -349,9 +353,10 @@ class LambdaResponseBuffered extends node_stream.Writable {
349
353
  headersToSet = statusMessageOrHeaders;
350
354
  }
351
355
  if (headersToSet) {
356
+ // Use direct _headers access to bypass dd-trace interception
352
357
  for (const [key, value] of Object.entries(headersToSet)) {
353
358
  if (value !== undefined) {
354
- this.setHeader(key, value);
359
+ this._headers.set(key.toLowerCase(), String(value));
355
360
  }
356
361
  }
357
362
  }
@@ -388,7 +393,8 @@ class LambdaResponseBuffered extends node_stream.Writable {
388
393
  return this;
389
394
  }
390
395
  json(data) {
391
- this.setHeader("content-type", "application/json");
396
+ // Use direct _headers access to bypass dd-trace interception
397
+ this._headers.set("content-type", "application/json");
392
398
  this.end(JSON.stringify(data));
393
399
  return this;
394
400
  }
@@ -608,36 +614,42 @@ class LambdaResponseStreaming extends node_stream.Writable {
608
614
  /**
609
615
  * Proxy for direct header access (e.g., res.headers['content-type']).
610
616
  * Required for compatibility with middleware like helmet that access headers directly.
617
+ * Uses direct _headers access to bypass dd-trace interception.
611
618
  */
612
619
  get headers() {
613
620
  return new Proxy({}, {
614
621
  deleteProperty: (_target, prop) => {
615
- this.removeHeader(String(prop));
622
+ if (!this._headersSent) {
623
+ this._headers.delete(String(prop).toLowerCase());
624
+ }
616
625
  return true;
617
626
  },
618
627
  get: (_target, prop) => {
619
628
  if (typeof prop === "symbol")
620
629
  return undefined;
621
- return this.getHeader(String(prop));
630
+ return this._headers.get(String(prop).toLowerCase());
622
631
  },
623
632
  getOwnPropertyDescriptor: (_target, prop) => {
624
- if (this.hasHeader(String(prop))) {
633
+ const lowerProp = String(prop).toLowerCase();
634
+ if (this._headers.has(lowerProp)) {
625
635
  return {
626
636
  configurable: true,
627
637
  enumerable: true,
628
- value: this.getHeader(String(prop)),
638
+ value: this._headers.get(lowerProp),
629
639
  };
630
640
  }
631
641
  return undefined;
632
642
  },
633
643
  has: (_target, prop) => {
634
- return this.hasHeader(String(prop));
644
+ return this._headers.has(String(prop).toLowerCase());
635
645
  },
636
646
  ownKeys: () => {
637
- return this.getHeaderNames();
647
+ return Array.from(this._headers.keys());
638
648
  },
639
649
  set: (_target, prop, value) => {
640
- this.setHeader(String(prop), value);
650
+ if (!this._headersSent) {
651
+ this._headers.set(String(prop).toLowerCase(), value);
652
+ }
641
653
  return true;
642
654
  },
643
655
  });
@@ -657,9 +669,10 @@ class LambdaResponseStreaming extends node_stream.Writable {
657
669
  headersToSet = statusMessageOrHeaders;
658
670
  }
659
671
  if (headersToSet) {
672
+ // Use direct _headers access to bypass dd-trace interception
660
673
  for (const [key, value] of Object.entries(headersToSet)) {
661
674
  if (value !== undefined) {
662
- this.setHeader(key, value);
675
+ this._headers.set(key.toLowerCase(), String(value));
663
676
  }
664
677
  }
665
678
  }
@@ -717,7 +730,8 @@ class LambdaResponseStreaming extends node_stream.Writable {
717
730
  return this;
718
731
  }
719
732
  json(data) {
720
- this.setHeader("content-type", "application/json");
733
+ // Use direct _headers access to bypass dd-trace interception
734
+ this._headers.set("content-type", "application/json");
721
735
  this.end(JSON.stringify(data));
722
736
  return this;
723
737
  }