Releases: sindresorhus/got
6.6.0
5.7.0 – Last minor release of 5.x branch
This is last release of 5.x
branch (which compatible with old versions of Node.JS). In this release we pulled all fixes (only UTF in headers is not cherry-picked):
- Add
url
to response (#236) - Add
requestUrl
to response in streaming mode (#230) - Allow non-plain object as request body (#217)
- Fixed unexpected EOF when decompressing content
- Detect formdata body and set content-type header (#220)
- Add a
requestUrl
property to the response object (#205) - Add redirect url to response object (#191)
🎃 Happy Halloween!
6.5.0
- Add a redirect
url
property to the response object (#191) - Add a
requestUrl
property to the response object (#205) - ⬆️
get-stream
bumped to^2.3.0
– which fixes some nasty encoding bugs - Fix location encoding (#214)
- Detect formdata body and set content-type header (#220)
- ⬆️
unzip-response
bumped to^2.0.1
– which fixesunexpected EOF
error - Allow non-plain object as request body (#217)
Changes
6.3.0
followRedirect
option
This option disables following redirects and got
will not treat them as errors:
const res = await got(`google.com`, {followRedirect: false});
res.statusCode === 302; // true
By default this option is true
, so no major changes in code are needed.
Changes
6.2.0
6.1.2
6.1.1
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