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

Function schemaHeaders

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

Source from the content-addressed store, hash-verified

207 * @since 4.0.0
208 */
209export const schemaHeaders = <A, I extends Readonly<Record<string, string | undefined>>, RD>(
210 schema: Schema.ConstraintCodec<A, I, RD, unknown>,
211 options?: ParseOptions | undefined
212): Effect.Effect<A, Schema.SchemaError, HttpServerRequest | RD> => {
213 const parse = Schema.decodeUnknownEffect(schema)
214 return Effect.flatMap(HttpServerRequest, (req) => parse(req.headers, options))
215}
216
217/**
218 * 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