npm.io
1.8.0 • Published 1 week ago

@arcjet/headers

Licence
Apache-2.0
Version
1.8.0
Deps
0
Size
18 kB
Vulns
0
Weekly
0
Stars
672
Arcjet Logo

@arcjet/headers

npm badge

Arcjet extension of the Headers class.

What is this?

This is an internal utility to help us deal with Headers. This exists to prevent the cookie header from being set and non-string values from being set.

When should I use this?

You should not use this but use Headers or plain objects instead. This package matches our current needs which are likely different from yours.

Install

This package is ESM only. Install with npm in Node.js:

npm install @arcjet/headers

Use

import { ArcjetHeaders } from "@arcjet/headers";

const headers = new ArcjetHeaders({ abc: "123" });

console.log(headers.get("abc")); // => "123"

API

This package exports the identifier ArcjetHeaders. The default export is ArcjetHeaders.

This package exports no TypeScript types.

new ArcjetHeaders([init])

Creates a new ArcjetHeaders instance. We use this internally to prevent the cookie header from being set and to ensure only string values are used.

Parameters
  • init (Headers | Array<[string, string]> | Record<string, Array<string> | string | undefined>, optional) — initial headers to set
Returns

An ArcjetHeaders instance that extends the standard Headers class.

License

Apache License, Version 2.0 Arcjet Labs, Inc.

Keywords