( schema: Schema.ConstraintCodec<A, I, RD, unknown>, options?: ParseOptions | undefined )
| 312 | * @since 4.0.0 |
| 313 | */ |
| 314 | export const schemaBodyForm = <A, I extends Partial<Multipart.Persisted>, RD>( |
| 315 | schema: Schema.ConstraintCodec<A, I, RD, unknown>, |
| 316 | options?: ParseOptions | undefined |
| 317 | ) => { |
| 318 | const parseMultipart = Multipart.schemaPersisted(schema) |
| 319 | const parseUrlParams = HttpIncomingMessage.schemaBodyUrlParams( |
| 320 | schema as Schema.ConstraintCodec<A, any, RD, unknown>, |
| 321 | options |
| 322 | ) |
| 323 | return Effect.flatMap(HttpServerRequest, (request): Effect.Effect< |
| 324 | A, |
| 325 | Multipart.MultipartError | Schema.SchemaError | HttpServerError, |
| 326 | RD | HttpServerRequest | Scope.Scope | FileSystem.FileSystem | Path.Path |
| 327 | > => { |
| 328 | if (isMultipart(request)) { |
| 329 | return Effect.flatMap(request.multipart, (_) => parseMultipart(_, options)) |
| 330 | } |
| 331 | return parseUrlParams(request) |
| 332 | }) |
| 333 | } |
| 334 | |
| 335 | /** |
| 336 | * Reads the current request body as URL-encoded parameters and decodes them with |
nothing calls this directly
no test coverage detected