Versions 149 to 150
new file, 224 lines
5+
7+
19+ if (method === "call") return { status: 200, body: { op: args[1], agent: args[2], body: args[3] } };
37+
46+
57+ assert.equal(PROJECT_ROUTE.exec("/p/game/a/alice/run"), null, "boxes are not on the open server");
60+ assert.deepEqual(ISSUES_ROUTE.exec("/issues/p/game/issues/4")?.slice(1), ["game", "/issues/4"]);
63+
67+ request("/p/game/a/alice/publish", { method: "POST", body: JSON.stringify({ message: "why" }) }),
73+ assert.deepEqual(await res.json(), { op: "publish", agent: "alice", body: { message: "why" } });
76+
77+ it("reads take their query as the body, and a read refuses a POST-only op as a GET", async () => {
84+
91+
98+ const ci = (await (await handle(request("/p/game/ci"), env, ctx, noIssues)).json()) as Record<string, unknown>;
105+
108+ const bad = await handle(request("/p/game/blobs/not-a-hash", { method: "PUT", body: "x" }), env, ctx, noIssues);
127+
128+ it("hands /issues to the issues code with the rest of the path and who is calling", async () => {
131+ const res = await handle(request("/issues/p/game/issues?open=1"), env, ctx, async (_r, _e, _c, where) => {
138+
142+ await handle(request("/issues/p/game/issues", { token: "abso_sk_abc" }), env, ctx, async (_r, _e, _c, where) => {
146+ assert.deepEqual(seen, { project: "game", rest: "/issues", auth: { kind: "key", agent: "carol", role: "writer" } });
148+
155+
159+ const res = await handle(request("/p/game/status", { token: "anything" }), env, ctx, noIssues);
162+ const empty = await authorize(request("/p/game/status", { token: null }), { ...env, ABSO_TOKEN: "" });
166+
169+ assert.equal((await handle(request("/p/game/status", { token: null }), env, ctx, noIssues)).status, 401);
170+ assert.equal((await handle(request("/p/game/status", { token: "wrong" }), env, ctx, noIssues)).status, 401);
171+ assert.equal((await handle(request("/p/game/status", { token: `${TOKEN}x` }), env, ctx, noIssues)).status, 401);
172+ assert.equal((await handle(request("/", { token: "wrong" }), env, ctx, noIssues)).status, 401);
176+
181+
187+ assert.deepEqual(await authorize(request("/p/game/status", { token: "abso_sk_abc" }), on.env), {
192+
198+
200+ const { env, calls } = fakeEnv({ AGENT_KEYS: "on", KEY_HMAC_SECRET: "s", ABSO_ADMIN_TOKEN: "admin-secret" });
202+ assert.equal((await handle(request(path, { method: "POST" }), env, ctx, noIssues)).status, 403);
205+ const key = request(path, { method: "POST", token: "abso_sk_abc", headers: { "x-abso-admin": "admin-secret" } });
213+
- MCP
- compare on this site's /mcp
- CLI
- abso diff 149 150 server/test/router.test.ts --json
- JSON
- /christopher/abso-core/compare/149..150?file=server%2Ftest%2Frouter.test.ts&format=json