Skip to content

Commit 0e6defc

Browse files
committed
fix status handler returns
1 parent c76c3db commit 0e6defc

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/api/status.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ export const statusHandler = async (req: Request, res: Response) => {
4949
const txHash = req.body?.txHash;
5050

5151
if (typeof txHash !== "string" || !txHash) {
52-
return res
53-
.status(400)
54-
.json({ message: "txHash must be a valid string." });
52+
res.status(400).json({ message: "txHash must be a valid string." });
53+
return;
5554
}
5655

5756
if (chainId && !isPositiveWholeNumber(chainId)) {
58-
return res
57+
res
5958
.status(400)
6059
.json({ message: "chainId, if defined, must be a number." });
60+
return;
6161
}
6262

6363
if (!enabledChainIds.includes(chainId.toString())) {
@@ -85,6 +85,7 @@ export const statusHandler = async (req: Request, res: Response) => {
8585

8686
if (existentRelayRequestData && existentRelayRequestData.length > 0) {
8787
res.status(200).json(existentRelayRequestData);
88+
return;
8889
}
8990

9091
const requestsForExecution = await EvmHandler.getRequestsForExecution(
@@ -118,10 +119,12 @@ export const statusHandler = async (req: Request, res: Response) => {
118119
processRelayRequests,
119120
);
120121

121-
return res.status(200).json(relayRequests);
122+
res.status(200).json(relayRequests);
123+
return;
122124
} catch (error) {
123125
console.error("Error handling status request:", error);
124126
res.status(500).json({ error: "Failed to process request" });
127+
return;
125128
}
126129
};
127130

0 commit comments

Comments
 (0)