Closed StefKors closed 2 years ago
Hi Stef. Thanks for the PR.
Whilst this PR does look fine, I think we should take a more general approach such that any headers can be provided.
I'd be open to a breaking change where we can provide a headers object, we should use the interface supplied by Fetch for this I think, i.e. https://github.com/node-fetch/node-fetch#new-headersinit
So the opts
would end up looking something like this
### `unfurl(url [, opts])`
#### url - `string`
---
#### opts - `object` of:
- `oembed?: boolean` - support retrieving oembed metadata
- `timeout? number` - req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies)
- `follow?: number` - maximum redirect count. 0 to not follow redirect
- `compress?: boolean` - support gzip/deflate content encoding
- `size?: number` - maximum response body size in bytes. 0 to disable
- `headers?: Headers` - map of request headers, overrides the defaults
even better, I'll update the MR 👍
@jacktuck It's ready for your review 👍
@StefKors Thanks! At first glance, this looks good 👍 I'll have a proper look soon.
Released in 6.0.0
Adds support for setting a Accept-Language header on fetch