| 82 | const Admin = HttpLayerRouter.add("GET", "/admin/stats", HttpServerResponse.text("admin stats")) |
| 83 | |
| 84 | const request = async ( |
| 85 | app: Layer.Layer<never, never, HttpLayerRouter.HttpRouter>, |
| 86 | init?: RequestInit, |
| 87 | path = "/admin/stats" |
| 88 | ) => { |
| 89 | const { dispose, handler } = HttpLayerRouter.toWebHandler(app.pipe(Layer.provide(HttpServer.layerContext)), { |
| 90 | disableLogger: true |
| 91 | }) |
| 92 | try { |
| 93 | const response = await handler(new Request(`http://localhost${path}`, init)) |
| 94 | return { status: response.status, body: await response.text() } |
| 95 | } finally { |
| 96 | await dispose() |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | test("only serves sub-app routes through the mount", async () => { |
| 101 | const app = HttpLayerRouter.use(Effect.fnUntraced(function*(router) { |