@ende/http/unstable-cache-control

ende add jsr:@ende/http

Version 2026.10.15 on JSR.

Parsing and formatting of the Cache-Control HTTP header per RFC 9111 Section 5.2.

Provides parseCacheControl to parse a header value into a typed object and formatCacheControl to serialize back to a header string.

Exports

  • CacheControl — Parsed Cache-Control value. Contains all directives from both request and response contexts with the widest applicable types. Returned by parseCacheControl and accepted by formatCacheControl.
  • CacheControlBase — Directives shared by both request and response Cache-Control headers.
  • formatCacheControl — Serializes a Cache-Control object to a header value string. Output is lowercase and comma-separated. Empty object produces an empty string.
  • parseCacheControl — Parses a `Cache-Control` header value into a typed object. Returns an empty object for `null` or empty string. Directive names are case-insensitive.
  • RequestCacheControl — Cache-Control directives for requests (e.g. from a client).
  • ResponseCacheControl — Cache-Control directives for responses (e.g. from a server).