@jaypie/express 1.2.4-rc11 → 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.
- package/dist/cjs/adapter/LambdaResponseBuffered.d.ts +2 -0
- package/dist/cjs/adapter/LambdaResponseStreaming.d.ts +2 -0
- package/dist/cjs/index.cjs +40 -24
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/adapter/LambdaResponseBuffered.d.ts +2 -0
- package/dist/esm/adapter/LambdaResponseStreaming.d.ts +2 -0
- package/dist/esm/index.js +40 -24
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -52,6 +53,7 @@ export declare class LambdaResponseBuffered extends Writable {
|
|
|
52
53
|
/**
|
|
53
54
|
* Add a field to the Vary response header.
|
|
54
55
|
* Used by CORS middleware to indicate response varies by Origin.
|
|
56
|
+
* Uses direct _headers access to bypass dd-trace interception.
|
|
55
57
|
*/
|
|
56
58
|
vary(field: string): this;
|
|
57
59
|
_write(chunk: Buffer | string, encoding: BufferEncoding, // eslint-disable-line no-undef
|
|
@@ -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;
|
|
@@ -53,6 +54,7 @@ export declare class LambdaResponseStreaming extends Writable {
|
|
|
53
54
|
/**
|
|
54
55
|
* Add a field to the Vary response header.
|
|
55
56
|
* Used by CORS middleware to indicate response varies by Origin.
|
|
57
|
+
* Uses direct _headers access to bypass dd-trace interception.
|
|
56
58
|
*/
|
|
57
59
|
vary(field: string): this;
|
|
58
60
|
_write(chunk: Buffer | string, encoding: BufferEncoding, // eslint-disable-line no-undef
|
package/dist/esm/index.js
CHANGED
|
@@ -301,36 +301,40 @@ class LambdaResponseBuffered extends Writable {
|
|
|
301
301
|
/**
|
|
302
302
|
* Proxy for direct header access (e.g., res.headers['content-type']).
|
|
303
303
|
* Required for compatibility with middleware like helmet that access headers directly.
|
|
304
|
+
* Uses direct _headers access to bypass dd-trace interception.
|
|
304
305
|
*/
|
|
305
306
|
get headers() {
|
|
306
307
|
return new Proxy({}, {
|
|
307
308
|
deleteProperty: (_target, prop) => {
|
|
308
|
-
this.
|
|
309
|
+
this._headers.delete(String(prop).toLowerCase());
|
|
309
310
|
return true;
|
|
310
311
|
},
|
|
311
312
|
get: (_target, prop) => {
|
|
312
313
|
if (typeof prop === "symbol")
|
|
313
314
|
return undefined;
|
|
314
|
-
return this.
|
|
315
|
+
return this._headers.get(String(prop).toLowerCase());
|
|
315
316
|
},
|
|
316
317
|
getOwnPropertyDescriptor: (_target, prop) => {
|
|
317
|
-
|
|
318
|
+
const lowerProp = String(prop).toLowerCase();
|
|
319
|
+
if (this._headers.has(lowerProp)) {
|
|
318
320
|
return {
|
|
319
321
|
configurable: true,
|
|
320
322
|
enumerable: true,
|
|
321
|
-
value: this.
|
|
323
|
+
value: this._headers.get(lowerProp),
|
|
322
324
|
};
|
|
323
325
|
}
|
|
324
326
|
return undefined;
|
|
325
327
|
},
|
|
326
328
|
has: (_target, prop) => {
|
|
327
|
-
return this.
|
|
329
|
+
return this._headers.has(String(prop).toLowerCase());
|
|
328
330
|
},
|
|
329
331
|
ownKeys: () => {
|
|
330
|
-
return this.
|
|
332
|
+
return Array.from(this._headers.keys());
|
|
331
333
|
},
|
|
332
334
|
set: (_target, prop, value) => {
|
|
333
|
-
this.
|
|
335
|
+
if (!this._headersSent) {
|
|
336
|
+
this._headers.set(String(prop).toLowerCase(), value);
|
|
337
|
+
}
|
|
334
338
|
return true;
|
|
335
339
|
},
|
|
336
340
|
});
|
|
@@ -347,9 +351,10 @@ class LambdaResponseBuffered extends Writable {
|
|
|
347
351
|
headersToSet = statusMessageOrHeaders;
|
|
348
352
|
}
|
|
349
353
|
if (headersToSet) {
|
|
354
|
+
// Use direct _headers access to bypass dd-trace interception
|
|
350
355
|
for (const [key, value] of Object.entries(headersToSet)) {
|
|
351
356
|
if (value !== undefined) {
|
|
352
|
-
this.
|
|
357
|
+
this._headers.set(key.toLowerCase(), String(value));
|
|
353
358
|
}
|
|
354
359
|
}
|
|
355
360
|
}
|
|
@@ -386,7 +391,8 @@ class LambdaResponseBuffered extends Writable {
|
|
|
386
391
|
return this;
|
|
387
392
|
}
|
|
388
393
|
json(data) {
|
|
389
|
-
|
|
394
|
+
// Use direct _headers access to bypass dd-trace interception
|
|
395
|
+
this._headers.set("content-type", "application/json");
|
|
390
396
|
this.end(JSON.stringify(data));
|
|
391
397
|
return this;
|
|
392
398
|
}
|
|
@@ -400,11 +406,12 @@ class LambdaResponseBuffered extends Writable {
|
|
|
400
406
|
/**
|
|
401
407
|
* Add a field to the Vary response header.
|
|
402
408
|
* Used by CORS middleware to indicate response varies by Origin.
|
|
409
|
+
* Uses direct _headers access to bypass dd-trace interception.
|
|
403
410
|
*/
|
|
404
411
|
vary(field) {
|
|
405
|
-
const existing = this.
|
|
412
|
+
const existing = this._headers.get("vary");
|
|
406
413
|
if (!existing) {
|
|
407
|
-
this.
|
|
414
|
+
this._headers.set("vary", field);
|
|
408
415
|
}
|
|
409
416
|
else {
|
|
410
417
|
// Append to existing Vary header if field not already present
|
|
@@ -412,7 +419,7 @@ class LambdaResponseBuffered extends Writable {
|
|
|
412
419
|
.split(",")
|
|
413
420
|
.map((f) => f.trim().toLowerCase());
|
|
414
421
|
if (!fields.includes(field.toLowerCase())) {
|
|
415
|
-
this.
|
|
422
|
+
this._headers.set("vary", `${existing}, ${field}`);
|
|
416
423
|
}
|
|
417
424
|
}
|
|
418
425
|
return this;
|
|
@@ -605,36 +612,42 @@ class LambdaResponseStreaming extends Writable {
|
|
|
605
612
|
/**
|
|
606
613
|
* Proxy for direct header access (e.g., res.headers['content-type']).
|
|
607
614
|
* Required for compatibility with middleware like helmet that access headers directly.
|
|
615
|
+
* Uses direct _headers access to bypass dd-trace interception.
|
|
608
616
|
*/
|
|
609
617
|
get headers() {
|
|
610
618
|
return new Proxy({}, {
|
|
611
619
|
deleteProperty: (_target, prop) => {
|
|
612
|
-
this.
|
|
620
|
+
if (!this._headersSent) {
|
|
621
|
+
this._headers.delete(String(prop).toLowerCase());
|
|
622
|
+
}
|
|
613
623
|
return true;
|
|
614
624
|
},
|
|
615
625
|
get: (_target, prop) => {
|
|
616
626
|
if (typeof prop === "symbol")
|
|
617
627
|
return undefined;
|
|
618
|
-
return this.
|
|
628
|
+
return this._headers.get(String(prop).toLowerCase());
|
|
619
629
|
},
|
|
620
630
|
getOwnPropertyDescriptor: (_target, prop) => {
|
|
621
|
-
|
|
631
|
+
const lowerProp = String(prop).toLowerCase();
|
|
632
|
+
if (this._headers.has(lowerProp)) {
|
|
622
633
|
return {
|
|
623
634
|
configurable: true,
|
|
624
635
|
enumerable: true,
|
|
625
|
-
value: this.
|
|
636
|
+
value: this._headers.get(lowerProp),
|
|
626
637
|
};
|
|
627
638
|
}
|
|
628
639
|
return undefined;
|
|
629
640
|
},
|
|
630
641
|
has: (_target, prop) => {
|
|
631
|
-
return this.
|
|
642
|
+
return this._headers.has(String(prop).toLowerCase());
|
|
632
643
|
},
|
|
633
644
|
ownKeys: () => {
|
|
634
|
-
return this.
|
|
645
|
+
return Array.from(this._headers.keys());
|
|
635
646
|
},
|
|
636
647
|
set: (_target, prop, value) => {
|
|
637
|
-
this.
|
|
648
|
+
if (!this._headersSent) {
|
|
649
|
+
this._headers.set(String(prop).toLowerCase(), value);
|
|
650
|
+
}
|
|
638
651
|
return true;
|
|
639
652
|
},
|
|
640
653
|
});
|
|
@@ -654,9 +667,10 @@ class LambdaResponseStreaming extends Writable {
|
|
|
654
667
|
headersToSet = statusMessageOrHeaders;
|
|
655
668
|
}
|
|
656
669
|
if (headersToSet) {
|
|
670
|
+
// Use direct _headers access to bypass dd-trace interception
|
|
657
671
|
for (const [key, value] of Object.entries(headersToSet)) {
|
|
658
672
|
if (value !== undefined) {
|
|
659
|
-
this.
|
|
673
|
+
this._headers.set(key.toLowerCase(), String(value));
|
|
660
674
|
}
|
|
661
675
|
}
|
|
662
676
|
}
|
|
@@ -714,7 +728,8 @@ class LambdaResponseStreaming extends Writable {
|
|
|
714
728
|
return this;
|
|
715
729
|
}
|
|
716
730
|
json(data) {
|
|
717
|
-
|
|
731
|
+
// Use direct _headers access to bypass dd-trace interception
|
|
732
|
+
this._headers.set("content-type", "application/json");
|
|
718
733
|
this.end(JSON.stringify(data));
|
|
719
734
|
return this;
|
|
720
735
|
}
|
|
@@ -728,11 +743,12 @@ class LambdaResponseStreaming extends Writable {
|
|
|
728
743
|
/**
|
|
729
744
|
* Add a field to the Vary response header.
|
|
730
745
|
* Used by CORS middleware to indicate response varies by Origin.
|
|
746
|
+
* Uses direct _headers access to bypass dd-trace interception.
|
|
731
747
|
*/
|
|
732
748
|
vary(field) {
|
|
733
|
-
const existing = this.
|
|
749
|
+
const existing = this._headers.get("vary");
|
|
734
750
|
if (!existing) {
|
|
735
|
-
this.
|
|
751
|
+
this._headers.set("vary", field);
|
|
736
752
|
}
|
|
737
753
|
else {
|
|
738
754
|
// Append to existing Vary header if field not already present
|
|
@@ -740,7 +756,7 @@ class LambdaResponseStreaming extends Writable {
|
|
|
740
756
|
.split(",")
|
|
741
757
|
.map((f) => f.trim().toLowerCase());
|
|
742
758
|
if (!fields.includes(field.toLowerCase())) {
|
|
743
|
-
this.
|
|
759
|
+
this._headers.set("vary", `${existing}, ${field}`);
|
|
744
760
|
}
|
|
745
761
|
}
|
|
746
762
|
return this;
|