Skip to content

Commit 0594121

Browse files
committed
add back responses
1 parent 940e2e2 commit 0594121

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,18 @@ export type TShallotSocketEvent<
4747

4848
const ShallotSocketWrapper = <TEvent extends TShallotSocketEvent = TShallotSocketEvent>(
4949
handler: ShallotRawHandler<TEvent>,
50-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
51-
_successStatusCode = 200,
50+
successStatusCode = 200,
5251
middlewareOpts: {
5352
HttpErrorHandlerOpts?: TShallotErrorHandlerOptions;
5453
HttpJsonBodyParserOpts?: TShallotJSONBodyParserOptions;
5554
} = {}
5655
): ShallotAWSHandler<TEvent, APIGatewayProxyResult> => {
5756
const wrappedResponseHandler: Handler = async (...args) => {
58-
await handler(...args);
57+
const res = await handler(...args);
58+
return {
59+
statusCode: successStatusCode,
60+
body: res == null ? undefined : JSON.stringify(res),
61+
};
5962
};
6063

6164
const wrapper = ShallotAWS(wrappedResponseHandler)

0 commit comments

Comments
 (0)