Fix default user agent string (#818)

Co-authored-by: Antoni Kepinski <xxczaki@pm.me>
This commit is contained in:
Konstantin Vyatkin 2020-05-25 10:56:04 -04:00 committed by GitHub
parent ca4703dd15
commit b3878b9a3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View File

@ -427,14 +427,15 @@ The default values are shown after each option key.
If no values are set, the following request headers will be sent automatically:
| Header | Value |
| ------------------- | -------------------------------------------------------- |
| `Accept-Encoding` | `gzip,deflate,br` _(when `options.compress === true`)_ |
| `Accept` | `*/*` |
| `Connection` | `close` _(when no `options.agent` is present)_ |
| `Content-Length` | _(automatically calculated, if possible)_ |
| `Transfer-Encoding` | `chunked` _(when `req.body` is a stream)_ |
| `User-Agent` | `node-fetch (+https://github.com/node-fetch/node-fetch)` |
| Header | Value |
| ------------------- | ------------------------------------------------------ |
| `Accept-Encoding` | `gzip,deflate,br` _(when `options.compress === true`)_ |
| `Accept` | `*/*` |
| `Connection` | `close` _(when no `options.agent` is present)_ |
| `Content-Length` | _(automatically calculated, if possible)_ |
| `Transfer-Encoding` | `chunked` _(when `req.body` is a stream)_ |
| `User-Agent` | `node-fetch` |
Note: when `body` is a `Stream`, `Content-Length` is not set automatically.

View File

@ -217,7 +217,7 @@ export function getNodeRequestOptions(request) {
// HTTP-network-or-cache fetch step 2.11
if (!headers.has('User-Agent')) {
headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)');
headers.set('User-Agent', 'node-fetch');
}
// HTTP-network-or-cache fetch step 2.15