Releases: sindresorhus/got
6.1.0
Non-retrieable errors
In got@5
we introduced retries
option, which (as name says) retry request on every Error. For most errors this was right thing to do, but in case ENETUNREACH
and ENOTFOUND
retries are pointless.
This version removes retries from such errors, so you will get instant error, when typo gets into configs.
Changes
5.3.1
6.0.0
Aiming on Node.js 4
This release drops Node.js 0.10/0.12 support, so we replaced lots of modules and reduce dependency tree more than twice (see PR overview). Module folder size reduced from 1.1 MB
to 216 KB
.
For older Node.js versions we will still maintain v5.x
for critical bug-fixes.
Promises by default
Callback interface was replaced by Promises, because it is a better way to work with asynchronous operations and they can be used with yield
/await
nicely.
If you use callback before:
got('todomvc.com', (err, body) => {
if (err) {
console.log(err);
return;
}
console.log(body);
});
You can rewrite it this way:
got('todomvc.com')
.then(res => {
console.log(res.body);
})
.catch(err => {
console.log(err);
});
You can read more about Promises in "ECMAScript 6 promises (2/2): the API" post and some caveats in "We have a problem with promises".
Update
$ npm install --save got@6
Changes
5.3.0
5.2.0
- 54bd6f5 default intervals between delays decreased - now they are around 1s, 2s, 4s, 8s, etc...
- a10a99e
retries
option accepts backoff function, for example you can:
// Constant delay of 10ms for 5 iterations
got('google.com', {
retries: iter => iter < 5 && 10
});
// Infinity retries with constant delay
got('google.com', {
retries: () => 10
});
5.1.0
5.0.0
Retries
We added retries on network failures with noisy exponential backoff. By default got
will try five times, before returning error.
Retries only applies to network errors (because network is not reliable). Requests with server errors, like 50x
status codes, will not be retried.
You can disable them by passing 0
to retries
option.
Update
$ npm install --save got@5
Highlights
- 0109725 Reject promise on internal exception
- df26918 Catch callbacks in stream mode
- f9f2807 Reduce size for browserify
- 066e612 Remove
response
event onerror
(in stream mode) (#110) - 62ff082 Catch
auth
option passed inurl
string (#106) - 6c59ce8 Add retries on network errors (#98)
- 9ffbbdf Deferred
response
event - 013a2b5
Changes
4.2.0
4.1.1
4.1.0 - x-www-form-urlencoded
- 7bea9c4 If
body
is a plain Object, it will be stringified and sent asapplication/x-www-form-urlencoded
.