Skip to content

Commit de705bd

Browse files
committed
Only send responses when message present
1 parent 9877d59 commit de705bd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@ const ShallotSocketWrapper = <TEvent extends TShallotSocketEvent = TShallotSocke
5555
): ShallotAWSHandler<TEvent, APIGatewayProxyResult> => {
5656
const wrappedResponseHandler: Handler = async (...args) => {
5757
const res = await handler(...args);
58-
return {
59-
statusCode: successStatusCode,
60-
body: res == null ? undefined : JSON.stringify(res),
61-
};
58+
if (res != null) {
59+
return {
60+
statusCode: successStatusCode,
61+
body: JSON.stringify(res),
62+
};
63+
}
6264
};
6365

6466
const wrapper = ShallotAWS(wrappedResponseHandler)

0 commit comments

Comments
 (0)