| 78 | } |
| 79 | |
| 80 | function toRequest(scenario: ActiveScenario, ctx: SeededContext<unknown>) { |
| 81 | const spec = scenario.request(ctx, ctx.state) |
| 82 | return new Request(new URL(spec.path, "http://localhost"), { |
| 83 | method: scenario.method, |
| 84 | headers: spec.body === undefined ? spec.headers : { "content-type": "application/json", ...spec.headers }, |
| 85 | body: spec.body === undefined ? undefined : JSON.stringify(spec.body), |
| 86 | }) |
| 87 | } |
| 88 | |
| 89 | function toAuthProbeRequest(scenario: ActiveScenario, credentials: "missing" | "valid", signal: AbortSignal) { |
| 90 | const spec = scenario.authProbe ?? { |