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

Function schemaCookies

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

Source from the content-addressed store, hash-verified

235 * @since 4.0.0
236 */
237export const schemaCookies = <A, I extends Readonly<Record<string, string | undefined>>, RD>(
238 schema: Schema.ConstraintCodec<A, I, RD, unknown>,
239 options?: ParseOptions | undefined
240): Effect.Effect<A, Schema.SchemaError, RD | HttpServerRequest> => {
241 const parse = Schema.decodeUnknownEffect(schema)
242 return Effect.flatMap(HttpServerRequest, (req) => parse(req.cookies, options))
243}
244
245/**
246 * Decodes a schema from the headers of the current request.

Callers

nothing calls this directly

Calls 1

parseFunction · 0.50

Tested by

no test coverage detected