Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion handlers/handleAlb.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ export default async function handleAlb(event, context) {
const invocation = collectInvocation(event, context, 'alb');
logDebug('invocation', invocation);
logDebug('handleAlb', { method: event.httpMethod, path: event.path, requestId: context.awsRequestId });
logDebug('event', event);
return {
statusCode: 200,
statusDescription: '200 OK',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message: 'Hello from ALB', event }),
body: JSON.stringify({ message: 'Hello from ALB' }),
};
}
3 changes: 2 additions & 1 deletion handlers/handleHttpV1.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ export default async function handleHttpV1(event, context) {
const invocation = collectInvocation(event, context, 'httpV1');
logDebug('invocation', invocation);
logDebug('handleHttpV1', { method: event.httpMethod, path: event.path, requestId: context.awsRequestId });
logDebug('event', event);
return {
statusCode: 200,
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message: 'Hello from API Gateway v1', event }),
body: JSON.stringify({ message: 'Hello from API Gateway v1' }),
};
}
3 changes: 2 additions & 1 deletion handlers/handleHttpV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ export default async function handleHttpV2(event, context) {
const invocation = collectInvocation(event, context, 'httpV2');
logDebug('invocation', invocation);
logDebug('handleHttpV2', { method: event.requestContext?.http?.method, path: event.rawPath, requestId: context.awsRequestId });
logDebug('event', event);
return {
statusCode: 200,
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message: 'Hello from API Gateway v2', event }),
body: JSON.stringify({ message: 'Hello from API Gateway v2' }),
};
}
4 changes: 2 additions & 2 deletions tests/handlers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('handler dispatch', () => {
expect(result).toEqual({
statusCode: 200,
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message: 'Hello from API Gateway v2', event })
body: JSON.stringify({ message: 'Hello from API Gateway v2' })
});
});

Expand All @@ -112,7 +112,7 @@ describe('handler dispatch', () => {
statusCode: 200,
statusDescription: '200 OK',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message: 'Hello from ALB', event })
body: JSON.stringify({ message: 'Hello from ALB' })
});
});

Expand Down
2 changes: 1 addition & 1 deletion tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('handler', () => {
expect(result).toEqual({
statusCode: 200,
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message: 'Hello from API Gateway v1', event })
body: JSON.stringify({ message: 'Hello from API Gateway v1' })
});
});

Expand Down
Loading