( schema: Schema.ConstraintCodec<A, I, RD, unknown>, options?: ParseOptions | undefined )
| 266 | * @since 4.0.0 |
| 267 | */ |
| 268 | export const schemaBodyForm = <A, I extends Partial<Multipart.Persisted>, RD>( |
| 269 | schema: Schema.ConstraintCodec<A, I, RD, unknown>, |
| 270 | options?: ParseOptions | undefined |
| 271 | ) => { |
| 272 | const parseMultipart = Multipart.schemaPersisted(schema) |
| 273 | const parseUrlParams = HttpIncomingMessage.schemaBodyUrlParams( |
| 274 | schema as Schema.ConstraintCodec<A, any, RD, unknown>, |
| 275 | options |
| 276 | ) |
| 277 | return Effect.flatMap(HttpServerRequest, (request): Effect.Effect< |
| 278 | A, |
| 279 | Multipart.MultipartError | Schema.SchemaError | HttpServerError, |
| 280 | RD | HttpServerRequest | Scope.Scope | FileSystem.FileSystem | Path.Path |
| 281 | > => { |
| 282 | if (isMultipart(request)) { |
| 283 | return Effect.flatMap(request.multipart, (_) => parseMultipart(_, options)) |
| 284 | } |
| 285 | return parseUrlParams(request) |
| 286 | }) |
| 287 | } |
| 288 | |
| 289 | /** |
| 290 | * Reads the current request body as URL-encoded parameters and decodes them with |
nothing calls this directly
no test coverage detected