You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: packages/headers/README.md
+15-20
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,8 @@ npm install @mjackson/headers
19
19
20
20
## Overview
21
21
22
+
The following should give you a sense of what kinds of things you can do with this library:
23
+
22
24
```ts
23
25
importHeadersfrom'@mjackson/headers';
24
26
@@ -204,33 +206,17 @@ console.log(`${headers}`);
204
206
// Accept-Language: en-US,en;q=0.9
205
207
```
206
208
207
-
## Low-level API
208
-
209
-
In addition to the high-level `Headers` API, `headers` also provides a rich set of primitives you can use to work with just about any complex HTTP header value. Each header class includes a spec-compliant parser (the constructor), stringifier (`toString`), and getters/setters for all relevant attributes. Classes for headers that contain a list of fields, like `Cookie`, are `Iterable`.
210
-
211
-
All individual header classes may be initialized with either a) the string value of the header or b) an `init` object specific to that header.
209
+
## Individual Header Utility Classes
212
210
213
-
The following headers are currently supported:
214
-
215
-
-[headers](#headers)
216
-
-[Installation](#installation)
217
-
-[Overview](#overview)
218
-
-[Low-level API](#low-level-api)
219
-
-[Accept](#accept)
220
-
-[Accept-Encoding](#accept-encoding)
221
-
-[Accept-Language](#accept-language)
222
-
-[Cache-Control](#cache-control)
223
-
-[Content-Disposition](#content-disposition)
224
-
-[Content-Type](#content-type)
225
-
-[Cookie](#cookie)
226
-
-[Set-Cookie](#set-cookie)
227
-
-[License](#license)
211
+
In addition to the high-level `Headers` API, `headers` also provides a rich set of primitives you can use to work with just about any complex HTTP header value. Each header class includes a spec-compliant parser (the constructor), stringifier (`toString`), and getters/setters for all relevant attributes. Classes for headers that contain a list of fields, like `Cookie`, are iterable.
228
212
229
213
If you need support for a header that isn't listed here, please [send a PR](https://github.com/mjackson/remix-the-web/pulls)! The goal is to have first-class support for all common HTTP headers.
230
214
231
215
### Accept
232
216
233
217
```ts
218
+
import { Accept } from'@mjackson/headers';
219
+
234
220
let header =newAccept('text/html;text/*;q=0.9');
235
221
236
222
header.has('text/html'); // true
@@ -255,6 +241,8 @@ let header = new Accept(['text/html', ['text/*', 0.9]]);
-[`fetch-proxy`](https://github.com/mjackson/remix-the-web/tree/main/packages/fetch-proxy) - Build HTTP proxy servers using the web fetch API
399
+
-[`node-fetch-server`](https://github.com/mjackson/remix-the-web/tree/main/packages/node-fetch-server) - Build HTTP servers on Node.js using the web fetch API
400
+
406
401
## License
407
402
408
403
See [LICENSE](https://github.com/mjackson/remix-the-web/blob/main/LICENSE)
0 commit comments