Comparing version 6.0.2 to 6.1.0
@@ -20,2 +20,3 @@ 'use strict'; | ||
const isPlainObj = require('is-plain-obj'); | ||
const isRetryAllowed = require('is-retry-allowed'); | ||
@@ -258,4 +259,4 @@ function requestAsEventEmitter(opts) { | ||
const retries = opts.retries; | ||
opts.retries = function backoff(iter) { | ||
if (iter > retries) { | ||
opts.retries = function backoff(iter, err) { | ||
if (iter > retries || !isRetryAllowed(err)) { | ||
return 0; | ||
@@ -262,0 +263,0 @@ } |
{ | ||
"name": "got", | ||
"version": "6.0.2", | ||
"version": "6.1.0", | ||
"description": "Simplified HTTP/HTTPS requests", | ||
@@ -48,7 +48,8 @@ "license": "MIT", | ||
"dependencies": { | ||
"create-error-class": "^3.0.0", | ||
"duplexer3": "^0.1.4", | ||
"create-error-class": "^3.0.0", | ||
"get-stream": "^1.1.0", | ||
"is-plain-obj": "^1.0.0", | ||
"is-redirect": "^1.0.0", | ||
"is-retry-allowed": "^1.0.0", | ||
"is-stream": "^1.0.0", | ||
@@ -62,3 +63,3 @@ "lowercase-keys": "^1.0.0", | ||
"devDependencies": { | ||
"ava": "^0.9.0", | ||
"ava": "^0.10.0", | ||
"coveralls": "^2.11.4", | ||
@@ -65,0 +66,0 @@ "get-port": "^2.0.0", |
@@ -22,3 +22,3 @@ <h1 align="center"> | ||
**WARNING: Node.js 4 or higher is required for got@6 and above.** For older Node.js versions use got@5. | ||
**WARNING: Node.js 4 or higher is required for got@6 and above.** For older Node.js versions use [got@5](https://github.com/sindresorhus/got/tree/v5.x). | ||
@@ -124,2 +124,4 @@ ``` | ||
**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). | ||
@@ -226,2 +228,21 @@ | ||
## Form data | ||
You can use the [`form-data`](https://www.npmjs.com/package/form-data) module to create POST request with form data: | ||
```js | ||
const fs = require('fs'); | ||
const got = require('got'); | ||
const FormData = require('form-data'); | ||
const form = new FormData(); | ||
form.append('my_file', fs.createReadStream('/foo/bar.jpg')); | ||
got.post('google.com', { | ||
headers: form.getHeaders(), | ||
body: form | ||
}); | ||
``` | ||
## Unix Domain Sockets | ||
@@ -228,0 +249,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
18858
263
291
12
+ Addedis-retry-allowed@^1.0.0
+ Addedis-retry-allowed@1.2.0(transitive)