| 214 | * Reads a clone, leaving the caller's request body intact for the transport. |
| 215 | */ |
| 216 | export const preInitializeMethodNotFound = (request: Request): Effect.Effect<Response | null> => |
| 217 | request.method !== "POST" || !passesTransportContentNegotiation(request) |
| 218 | ? Effect.succeed(null) |
| 219 | : Effect.tryPromise({ |
| 220 | try: (): Promise<unknown> => request.clone().json(), |
| 221 | catch: () => null, |
| 222 | }).pipe( |
| 223 | // A body we cannot read is simply not ours to answer; hand it on. |
| 224 | Effect.orElseSucceed(() => null), |
| 225 | Effect.map(renderPreInitializeMethodNotFound), |
| 226 | ); |
| 227 | |
| 228 | /** The pure decision behind {@link preInitializeMethodNotFound}. */ |
| 229 | const renderPreInitializeMethodNotFound = (body: unknown): Response | null => { |