fix(gateway): let non-GET requests fall through controlUi routing when basePath is set

When controlUiBasePath is set, classifyControlUiRequest returned
method-not-allowed (405) for all non-GET/HEAD requests under basePath,
blocking plugin webhook handlers (BlueBubbles, Mattermost, etc.) from
receiving POST requests. This is a 2026.3.1 regression.

Return not-control-ui instead, matching the empty-basePath behavior, so
requests fall through to plugin HTTP handlers. Remove the now-dead
method-not-allowed type variant, handler branch, and utility function.

Closes #31983
Closes #32275

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ademczuk
2026-03-03 00:51:23 +01:00
committed by Peter Steinberger
parent 11c397ef46
commit 3e9c8721fb
5 changed files with 19 additions and 18 deletions

View File

@@ -402,19 +402,18 @@ describe("handleControlUiHttpRequest", () => {
});
});
it("returns 405 for POST requests under configured basePath", async () => {
it("falls through POST requests under configured basePath (plugin webhook passthrough)", async () => {
await withControlUiRoot({
fn: async (tmp) => {
for (const route of ["/openclaw", "/openclaw/", "/openclaw/some-page"]) {
const { handled, res, end } = runControlUiRequest({
const { handled, end } = runControlUiRequest({
url: route,
method: "POST",
rootPath: tmp,
basePath: "/openclaw",
});
expect(handled, `expected ${route} to be handled`).toBe(true);
expect(res.statusCode, `expected ${route} status`).toBe(405);
expect(end, `expected ${route} body`).toHaveBeenCalledWith("Method Not Allowed");
expect(handled, `POST to ${route} should pass through to plugin handlers`).toBe(false);
expect(end, `POST to ${route} should not write a response`).not.toHaveBeenCalled();
}
},
});