{"draft":null,"from":87,"to":88,"files":[{"path":"client/test/visitor.test.ts","added":24,"removed":0,"diff":"--- a/client/test/visitor.test.ts\n+++ b/client/test/visitor.test.ts\n@@ -16,6 +16,7 @@\n import { tmpdir } from \"node:os\";\n import { join, resolve } from \"node:path\";\n import { after, before, describe, it } from \"node:test\";\n+import { Api } from \"../src/api.ts\";\n import { writeBox } from \"../src/box.ts\";\n import { writeConfig } from \"../src/config.ts\";\n import { isPublic } from \"../src/join-commands.ts\";\n@@ -257,6 +258,29 @@\n \t\tassert.match(runs[0]!.stderr, /isn't signed in to .*abso login signs it in/);\n \t});\n \n+\tit(\"every request its Api makes goes through one send: reads only, no redirect, no sign-in\", async () => {\n+\t\tconst real = globalThis.fetch;\n+\t\tconst calls: RequestInit[] = [];\n+\t\tglobalThis.fetch = (async (_input: unknown, init?: RequestInit) => {\n+\t\t\tcalls.push(init ?? {});\n+\t\t\treturn new Response(\"{}\", { status: 200 });\n+\t\t}) as typeof fetch;\n+\t\ttry {\n+\t\t\tconst visitor = new Api({ server: url, project: \"abso-core\", agent: \"\", visitor: true, token: TOKEN });\n+\t\t\tawait visitor.send(`${url}/p/abso-core/serve`, { headers: visitor.headers() });\n+\t\t\tawait assert.rejects(visitor.send(`${url}/p/abso-core/a/x/run`, { method: \"POST\" }), /sends only reads/);\n+\t\t\tconst member = new Api({ server: url, project: \"abso-core\", agent: \"x\", token: TOKEN });\n+\t\t\tawait member.send(`${url}/p/abso-core/serve`, { headers: member.headers() });\n+\t\t} finally {\n+\t\t\tglobalThis.fetch = real;\n+\t\t}\n+\t\tassert.equal(calls.length, 2);\n+\t\tassert.equal(calls[0]!.redirect, \"error\");\n+\t\tassert.equal(new Headers(calls[0]!.headers).get(\"authorization\"), null);\n+\t\tassert.equal(calls[1]!.redirect, undefined);\n+\t\tassert.equal(new Headers(calls[1]!.headers).get(\"authorization\"), `Bearer ${TOKEN}`);\n+\t});\n+\n \tit(\"runs only its reads: every other command is refused before any call, and a new command fails here\", async () => {\n \t\tconst sorted = new Set([...Object.keys(VISITOR_READS), ...VISITOR_ELSEWHERE, ...REFUSED]);\n \t\tfor (const name of Object.keys(commandTable()))"}],"unmatched":[]}