headers provides focused classes for common HTTP headers.
Features
- Header-Specific Classes - Purpose-built APIs for
Accept,Cache-Control,Content-Type, and more - Round-Trip Safety - Parse from raw values and serialize back with
.toString() - Typed Operations - Work with structured values instead of manual string parsing
Installation
Supported Headers
Each supported header has a class that represents the header value. Use the staticfrom() method to parse header values. Each class has a toString() method that returns the header value as a string.
- Accept
- Accept-Encoding
- Accept-Language
- Cache-Control
- Content-Disposition
- Content-Range
- Content-Type
- Cookie
- If-Match
- If-None-Match
- If-Range
- Range
- Set-Cookie
- Vary
Accept
Parse, manipulate and stringifyAccept headers.
Implements Map<mediaType, quality>.
Accept-Encoding
Parse, manipulate and stringifyAccept-Encoding headers.
Implements Map<encoding, quality>.
Accept-Language
Parse, manipulate and stringifyAccept-Language headers.
Implements Map<language, quality>.
Cache-Control
Parse, manipulate and stringifyCache-Control headers.
Content-Disposition
Parse, manipulate and stringifyContent-Disposition headers.
Content-Range
Parse, manipulate and stringifyContent-Range headers.
Content-Type
Parse, manipulate and stringifyContent-Type headers.
Cookie
Parse, manipulate and stringifyCookie headers.
Implements Map<name, value>.
If-Match
Parse, manipulate and stringifyIf-Match headers.
Implements Set<etag>.
If-None-Match
Parse, manipulate and stringifyIf-None-Match headers.
Implements Set<etag>.
If-Range
Parse, manipulate and stringifyIf-Range headers.
Range
Parse, manipulate and stringifyRange headers.
Set-Cookie
Parse, manipulate and stringifySet-Cookie headers.
Vary
Parse, manipulate and stringifyVary headers.
Implements Set<headerName>.
Raw Headers
Parse and stringify raw HTTP header strings.Related Packages
fetch-proxy- Build HTTP proxy servers using the web fetch APInode-fetch-server- Build HTTP servers on Node.js using the web fetch API