MCPcopy Create free account
hub / github.com/Effect-TS/effect / schemaBodyMultipart

Function schemaBodyMultipart

packages/effect/src/http/HttpServerRequest.ts:368–381  ·  view source on GitHub ↗
(
  schema: Schema.ConstraintCodec<A, I, RD, unknown>,
  options?: ParseOptions | undefined
)

Source from the content-addressed store, hash-verified

366 * @since 4.0.0
367 */
368export const schemaBodyMultipart = <A, I extends Partial<Multipart.Persisted>, RD>(
369 schema: Schema.ConstraintCodec<A, I, RD, unknown>,
370 options?: ParseOptions | undefined
371): Effect.Effect<
372 A,
373 Multipart.MultipartError | Schema.SchemaError,
374 HttpServerRequest | Scope.Scope | FileSystem.FileSystem | Path.Path | RD
375> => {
376 const parse = Multipart.schemaPersisted(schema)
377 return HttpServerRequest.pipe(
378 Effect.flatMap((_) => _.multipart),
379 Effect.flatMap((_) => parse(_, options))
380 )
381}
382
383/**
384 * Creates a decoder for a JSON value stored in a form field.

Callers

nothing calls this directly

Calls 2

pipeMethod · 0.65
parseFunction · 0.50

Tested by

no test coverage detected