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

Function schemaCookies

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

Source from the content-addressed store, hash-verified

193 * @since 4.0.0
194 */
195export const schemaCookies = <A, I extends Readonly<Record<string, string | undefined>>, RD>(
196 schema: Schema.ConstraintCodec<A, I, RD, unknown>,
197 options?: ParseOptions | undefined
198): Effect.Effect<A, Schema.SchemaError, RD | HttpServerRequest> => {
199 const parse = Schema.decodeUnknownEffect(schema)
200 return Effect.flatMap(HttpServerRequest, (req) => parse(req.cookies, options))
201}
202
203/**
204 * 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