(req: HttpServerRequest.HttpServerRequest)
| 124 | * recoverable error. |
| 125 | */ |
| 126 | const toWebRequest = (req: HttpServerRequest.HttpServerRequest): Effect.Effect<Request> => |
| 127 | Effect.gen(function* () { |
| 128 | if (req.source instanceof Request) return req.source; |
| 129 | const headers = new Headers(req.headers as Record<string, string>); |
| 130 | const hasBody = req.method !== "GET" && req.method !== "HEAD"; |
| 131 | // oxlint-disable-next-line executor/no-effect-escape-hatch -- boundary: rebuilding a web Request from a non-web source; a failed body read is an unrecoverable infra defect, not a domain error |
| 132 | const body = hasBody ? yield* req.text.pipe(Effect.orDie) : undefined; |
| 133 | return new Request(req.url, { method: req.method, headers, body }); |
| 134 | }); |
| 135 | |
| 136 | /** Serve a provider discovery document, wrapping its web `Response`. */ |
| 137 | const discoveryRoute = (handler: (request: Request) => Effect.Effect<Response>) => |
no outgoing calls
no test coverage detected