(input: { password?: string; username?: string })
| 10 | import { disposeAllInstances, tmpdir } from "../fixture/fixture" |
| 11 | |
| 12 | function app(input: { password?: string; username?: string }) { |
| 13 | const handler = HttpRouter.toWebHandler( |
| 14 | HttpApiApp.routes.pipe( |
| 15 | Layer.provide( |
| 16 | ConfigProvider.layer( |
| 17 | ConfigProvider.fromUnknown({ |
| 18 | OPENCODE_SERVER_PASSWORD: input.password, |
| 19 | OPENCODE_SERVER_USERNAME: input.username, |
| 20 | }), |
| 21 | ), |
| 22 | ), |
| 23 | ), |
| 24 | { disableLogger: true }, |
| 25 | ).handler |
| 26 | |
| 27 | return { |
| 28 | fetch: (request: Request) => handler(request, HttpApiApp.context), |
| 29 | request(input: string | URL | Request, init?: RequestInit) { |
| 30 | return this.fetch(input instanceof Request ? input : new Request(new URL(input, "http://localhost"), init)) |
| 31 | }, |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | function basic(username: string, password: string) { |
| 36 | return ServerAuth.header({ username, password }) ?? "" |
no test coverage detected