Skip to content

Commit

Permalink
Tighten up thenReply valid headers for trailers check
Browse files Browse the repository at this point in the history
Any set value is actually sufficient to cause issues - even just {}
disables the default headers, which makes trailers unsendable.
  • Loading branch information
pimterry committed May 1, 2024
1 parent 0762f07 commit bcf6eb9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/rules/requests/request-handler-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export class SimpleHandlerDefinition extends Serializable implements RequestHand
validateCustomHeaders({}, headers);
validateCustomHeaders({}, trailers);

if (!_.isEmpty(trailers) && !_.isEmpty(headers)) {
if (!_.isEmpty(trailers) && headers) {
if (!Object.entries(headers!).some(([key, value]) =>
key.toLowerCase() === 'transfer-encoding' && value === 'chunked'
)) {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/subscriptions/response-events.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ describe("Response subscriptions", () => {
});

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

Expand Down

0 comments on commit bcf6eb9

Please sign in to comment.