Optionalinit: HeadersInit | Record<string, string | string[]> | HttpHeaders | nullOptional initial headers (WHATWG Headers, HttpHeaders,
plain object, or [name, value][] array)
Guard mode (default: "none")
The string tag "HttpHeaders"
Number of distinct header names.
Append a value to an existing header (or create it). Unlike set, this does NOT overwrite existing values.
Header name (case-insensitive)
Header value (leading/trailing OWS stripped)
Return the combined value of a header. Multiple values are joined with ", " except for Set-Cookie / WWW-Authenticate / Proxy-Authenticate, which return only the first value.
Header name (case-insensitive)
The combined header value, or null if absent
Return all values for a header as an array (useful for Set-Cookie).
Header name (case-insensitive)
Array of values (empty if absent)
Check if a header exists.
Header name (case-insensitive)
true if the header is set
Execute a callback for each header entry. Multi-value headers are joined with ", " for the callback, except for Set-Cookie (each value is called separately).
Called once per combined value with (value, name, headers)
OptionalthisArg: unknownValue for this inside the callback
Iterator over all header names (lowercased).
Iterator over all header values. Multi-value headers are joined with ", " except Set-Cookie.
Iterator over [name, value] tuples (WHATWG Headers-compatible).
Convert to a plain object. Multi-value headers become arrays.
Convert to a flat object. Multi-value headers are joined with ", ".
Serialize as HTTP/1.1 header block (CRLF-delimited).
Return a new immutable copy.
Merge another headers source into this one.
Existing values are overwritten unless append is true.
Return a new HttpHeaders containing only the listed header names.
Return a new HttpHeaders without the listed header names.
Redact sensitive header values (replace with "REDACTED"). Useful for logging.
Returns headers present in other that differ from this instance
(by combined value). Useful for diffing request/response headers.
Cross-runtime HTTP headers implementation compatible with the WHATWG Fetch spec Headers interface. Supports guard-based mutation control, RFC 7230 validation, and rich typed accessors.
Differences from WHATWG Headers: