Skip to content

ParseCookies

[Source]

Parse cookies from HTTP request headers.

Implements lenient parsing per RFC 6265 §5.4: splits on ;, uses the first = as the name-value delimiter, trims whitespace, strips surrounding double quotes from values, and skips entries with empty names or missing =.

This is a total function — it never errors. Malformed cookie strings produce an empty or partial RequestCookies collection rather than an error.

Two entry points:

  • from_headers() — extracts and parses all Cookie headers from a Headers val collection. This is what HTTPServer uses internally.
  • apply() — parses a single Cookie header value string. Useful for testing or when you already have the raw header value.
primitive val ParseCookies

Constructors

create

[Source]

new val create()
: ParseCookies val^

Returns


Public Functions

from_headers

[Source]

Parse all Cookie headers from the given header collection.

Multiple Cookie headers are concatenated per RFC 6265 §5.4.

fun box from_headers(
  headers: Headers val)
: RequestCookies val

Parameters

Returns


apply

[Source]

Parse a single Cookie header value string.

fun box apply(
  header_value: String val)
: RequestCookies val

Parameters

Returns


eq

[Source]

fun box eq(
  that: ParseCookies val)
: Bool val

Parameters

Returns


ne

[Source]

fun box ne(
  that: ParseCookies val)
: Bool val

Parameters

Returns