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

Function schemaHeaders

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

Source from the content-addressed store, hash-verified

250 * @since 4.0.0
251 */
252export const schemaHeaders = <A, I extends Readonly<Record<string, string | undefined>>, RD>(
253 schema: Schema.ConstraintCodec<A, I, RD, unknown>,
254 options?: ParseOptions | undefined
255): Effect.Effect<A, Schema.SchemaError, HttpServerRequest | RD> => {
256 const parse = Schema.decodeUnknownEffect(schema)
257 return Effect.flatMap(HttpServerRequest, (req) => parse(req.headers, options))
258}
259
260/**
261 * Decodes a schema from the parsed search parameters of the current request.

Callers

nothing calls this directly

Calls 1

parseFunction · 0.50

Tested by

no test coverage detected