MCPcopy Index your code
hub / github.com/anomalyco/opencode / runAuth

Function runAuth

packages/opencode/test/server/httpapi-exercise/runner.ts:47–60  ·  view source on GitHub ↗
(scenario: ActiveScenario)

Source from the content-addressed store, hash-verified

45}
46
47function runAuth(scenario: ActiveScenario) {
48 return Effect.gen(function* () {
49 const result = yield* callAuthProbe(scenario, "missing")
50 if (scenario.auth === "protected") {
51 if (result.status !== 401) throw new Error(`auth expected 401, got ${result.status}`)
52 const authed = yield* callAuthProbe(scenario, "valid")
53 if (authed.status === 401) throw new Error("auth rejected valid credentials")
54 return
55 }
56
57 if (result.status === 401) throw new Error("auth expected public access, got 401")
58 if (result.timedOut) throw new Error("auth expected public access, probe timed out")
59 })
60}
61
62function withContext<A, E>(
63 options: Options,

Callers 1

runActiveFunction · 0.85

Calls 1

callAuthProbeFunction · 0.90

Tested by

no test coverage detected