Skip to content

Commit

Permalink
apollo-server-lambda tests: adapt mock ALB server for upgrade
Browse files Browse the repository at this point in the history
CodeGenieApp/serverless-express#392 makes the handler
return headers in the field matching the one where it receives request
headers: `headers` or `multiValueHeaders`. (I guess this is a preference
for ALB?) Our mock server needs to be consistent in which one it looks
at. This is a test-only change.
  • Loading branch information
glasser committed Oct 20, 2021
1 parent d43603c commit 81e3e71
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/apollo-server-lambda/src/__tests__/mockALBServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,9 @@ export function createMockServer(handler: ALBHandler) {
},
)) as ALBResult;
res.statusCode = result.statusCode!;
Object.entries(result.multiValueHeaders ?? {}).forEach(
([key, values]) => {
res.setHeader(
key,
values.map((v) => v.toString()),
);
},
);
Object.entries(result.headers ?? {}).forEach(([key, value]) => {
res.setHeader(key, value.toString());
});
res.write(result.body);
res.end();
});
Expand Down

0 comments on commit 81e3e71

Please sign in to comment.