Skip to content

Commit

Permalink
fix(docs): update usage of "getRawHeaders" method
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed Sep 13, 2023
1 parent 80c53f0 commit 950bf2c
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ Various request issuing libraries utilize a different format of headers. This li

```bash
npm install headers-polyfill
# or
yarn add headers-polyfill
```

## Polyfill
Expand Down Expand Up @@ -49,27 +47,11 @@ As well as the iterator methods:
- [`.values()`](https://developer.mozilla.org/en-US/docs/Web/API/Headers/values)
- [`.entries()`](https://developer.mozilla.org/en-US/docs/Web/API/Headers/entries)

### Custom methods

In addition, the polyfill instance has the following methods:

- `.all()`

Returns the object of the _normalized_ header name/value pairs.

```js
const headers = new Headers({
Accept: '*/*',
'Content-Type': 'application/json',
})

headers.all()
// { "accept": "*/*", "content-type": "application/json" }
```
## Transformations

- `.raw()`
### `getRawHeaders()`

Similar to the `.all()` method, `.raw()` returns an object consisting of the header name/value pairs, but preserving raw header names.
Returns an object consisting of the header name/value pairs but preserving raw header names.

```js
const headers = new Headers({
Expand All @@ -81,8 +63,6 @@ headers.raw()
// { "Accept": "*/*", "Content-Type": "application/json" }
```

## Transformations

### Headers ⭢ N

- `headersToString: (h: Headers): string`
Expand Down

0 comments on commit 950bf2c

Please sign in to comment.