Skip to content

Commit bcf6eb9

Browse files
committed
Tighten up thenReply valid headers for trailers check
Any set value is actually sufficient to cause issues - even just {} disables the default headers, which makes trailers unsendable.
1 parent 0762f07 commit bcf6eb9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/rules/requests/request-handler-definitions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ export class SimpleHandlerDefinition extends Serializable implements RequestHand
279279
validateCustomHeaders({}, headers);
280280
validateCustomHeaders({}, trailers);
281281

282-
if (!_.isEmpty(trailers) && !_.isEmpty(headers)) {
282+
if (!_.isEmpty(trailers) && headers) {
283283
if (!Object.entries(headers!).some(([key, value]) =>
284284
key.toLowerCase() === 'transfer-encoding' && value === 'chunked'
285285
)) {

test/integration/subscriptions/response-events.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ describe("Response subscriptions", () => {
171171
});
172172

173173
it("should include raw trailer data", async () => {
174-
await server.forGet('/mocked-endpoint').thenReply(200, undefined, {}, {
174+
await server.forGet('/mocked-endpoint').thenReply(200, undefined, undefined, {
175175
"custom-TRAILER": "TRAILER-value"
176176
});
177177

0 commit comments

Comments
 (0)