(route: string, directory: string, query?: Record<string, string>)
| 10 | const context = Context.empty() as Context.Context<unknown> |
| 11 | |
| 12 | function request(route: string, directory: string, query?: Record<string, string>) { |
| 13 | const url = new URL(`http://localhost${route}`) |
| 14 | for (const [key, value] of Object.entries(query ?? {})) { |
| 15 | url.searchParams.set(key, value) |
| 16 | } |
| 17 | return HttpApiApp.webHandler().handler( |
| 18 | new Request(url, { |
| 19 | headers: { |
| 20 | "x-opencode-directory": directory, |
| 21 | }, |
| 22 | }), |
| 23 | context, |
| 24 | ) |
| 25 | } |
| 26 | |
| 27 | afterEach(async () => { |
| 28 | await disposeAllInstances() |