Skip to content

Commit

Permalink
docs: garbage collection HEAD method note
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkldshv committed Jul 2, 2022
1 parent e53242d commit c2b1c21
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -283,6 +283,13 @@ const headers = await fetch(url)
.then(res => res.headers)
```

However, if you want to get only headers, it might be better to use `HEAD` request method.

```js
const headers = await fetch(url, { method: 'HEAD' })
.then(res => res.headers)
```

##### Forbidden and Safelisted Header Names

* https://fetch.spec.whatwg.org/#cors-safelisted-response-header-name
Expand Down

0 comments on commit c2b1c21

Please sign in to comment.