mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 05:51:24 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -23,7 +23,9 @@ describe("registerSlackHttpHandler", () => {
|
||||
const unregisters: Array<() => void> = [];
|
||||
|
||||
afterEach(() => {
|
||||
for (const unregister of unregisters.splice(0)) unregister();
|
||||
for (const unregister of unregisters.splice(0)) {
|
||||
unregister();
|
||||
}
|
||||
});
|
||||
|
||||
it("routes requests to a registered handler", async () => {
|
||||
|
||||
@@ -16,7 +16,9 @@ const slackHttpRoutes = new Map<string, SlackHttpRequestHandler>();
|
||||
|
||||
export function normalizeSlackWebhookPath(path?: string | null): string {
|
||||
const trimmed = path?.trim();
|
||||
if (!trimmed) return "/slack/events";
|
||||
if (!trimmed) {
|
||||
return "/slack/events";
|
||||
}
|
||||
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
||||
}
|
||||
|
||||
@@ -39,7 +41,9 @@ export async function handleSlackHttpRequest(
|
||||
): Promise<boolean> {
|
||||
const url = new URL(req.url ?? "/", "http://localhost");
|
||||
const handler = slackHttpRoutes.get(url.pathname);
|
||||
if (!handler) return false;
|
||||
if (!handler) {
|
||||
return false;
|
||||
}
|
||||
await handler(req, res);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user