refactor(gateway): unify control-ui and plugin webhook routing

This commit is contained in:
Peter Steinberger
2026-03-02 16:17:31 +00:00
parent 21708f58ce
commit b13d48987c
17 changed files with 870 additions and 425 deletions

View File

@@ -0,0 +1,19 @@
import type { ServerResponse } from "node:http";
export function isReadHttpMethod(method: string | undefined): boolean {
return method === "GET" || method === "HEAD";
}
export function respondPlainText(res: ServerResponse, statusCode: number, body: string): void {
res.statusCode = statusCode;
res.setHeader("Content-Type", "text/plain; charset=utf-8");
res.end(body);
}
export function respondNotFound(res: ServerResponse): void {
respondPlainText(res, 404, "Not Found");
}
export function respondMethodNotAllowed(res: ServerResponse): void {
respondPlainText(res, 405, "Method Not Allowed");
}