Comparing version 6.1.1 to 6.1.2
@@ -21,2 +21,3 @@ 'use strict'; | ||
const isRetryAllowed = require('is-retry-allowed'); | ||
const pkg = require('./package.json'); | ||
@@ -104,3 +105,3 @@ function requestAsEventEmitter(opts) { | ||
if (opts.json && statusCode !== 204) { | ||
if (opts.json && res.body) { | ||
try { | ||
@@ -207,3 +208,3 @@ res.body = JSON.parse(res.body); | ||
opts.headers = Object.assign({ | ||
'user-agent': 'https://github.com/sindresorhus/got', | ||
'user-agent': `${pkg.name}/${pkg.version} (https://github.com/sindresorhus/got)`, | ||
'accept-encoding': 'gzip,deflate' | ||
@@ -210,0 +211,0 @@ }, lowercaseKeys(opts.headers)); |
{ | ||
"name": "got", | ||
"version": "6.1.1", | ||
"version": "6.1.2", | ||
"description": "Simplified HTTP/HTTPS requests", | ||
@@ -62,3 +62,3 @@ "license": "MIT", | ||
"devDependencies": { | ||
"ava": "^0.11.0", | ||
"ava": "^0.12.0", | ||
"coveralls": "^2.11.4", | ||
@@ -65,0 +65,0 @@ "get-port": "^2.0.0", |
@@ -121,9 +121,9 @@ <h1 align="center"> | ||
Number of request retries when network errors happens. Delays between retries counts with function `Math.pow(2, retry) + Math.random() * 100`, where `retry` is attempt number (starts from 0). | ||
Number of request retries when network errors happens. Delays between retries counts with function `1000 * Math.pow(2, retry) + Math.random() * 100`, where `retry` is attempt number (starts from 0). | ||
**Note:** `ENOTFOUND` and `ENETUNREACH` error will not be retried (see full list in [`is-retry-allowed`](https://github.com/floatdrop/is-retry-allowed/blob/master/index.js#L12) module). | ||
Option accepts `function` with `retry` and `error` arguments. Function must return delay in milliseconds (`0` return value cancels retry). | ||
**Note:** if `retries` is `number`, `ENOTFOUND` and `ENETUNREACH` error will not be retried (see full list in [`is-retry-allowed`](https://github.com/floatdrop/is-retry-allowed/blob/master/index.js#L12) module). | ||
#### Streams | ||
@@ -267,6 +267,7 @@ | ||
const got = require('got'); | ||
const pkg = require('./package.json'); | ||
got('todomvc.com', { | ||
headers: { | ||
'user-agent': 'https://github.com/your-username/repo-name' | ||
'user-agent': `my-module/${pkg.version} (https://github.com/username/my-module)` | ||
} | ||
@@ -273,0 +274,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19021
265
292