got
16.2.0 · 30 Oct 2026MIT53.2M / weekRepositoryHomepagenpmAtom feed
188 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 9.x
9.3.0
30 Oct 20189.2.0
31 Aug 2018Add
cookieJaroption. (#596) eedebc9
Add
cookieJaroption. (#596) eedebc9Set
content-lengthheader to zero when doing a PUT request with no body. (#584) 9a966ecDon't parse the
queryoption when it's a string. (#589) f23f350Document the
responseobject. (#592) 267cb66Fix Electron throwing
HTTP trailers are not supportederror. (#598) e66a6b6
9.1.0
23 Aug 2018Add
got.mergeInstances()which lets you easily compose multiple instances of Got into a single one. It's like plugins without any of the plugin mess. (#510) f0b190a
Add
got.mergeInstances()which lets you easily compose multiple instances of Got into a single one. It's like plugins without any of the plugin mess. (#510) f0b190aAllow the
queryoption to be aURLSearchParamsinstance. (#565) b8a086fSupport retrying on 500 HTTP status code. a3e77de
Bump
get-streamto 0.4.0 for improved handling of stream edge-cases. (#578) 45d3a60
9.0.0
4 Aug 2018- Breaking
Requires Node.js 8.
You might ask, why not follow the Node.js LTS cycle and target Node.js 6. In short, async/await and WHATWG URL, which enabled us to simplify the codebase and reduce the dependency-tree considerably. Got v8 is a stable release, and you can continue using that if you need to support Node.js 6. - Breaking
The retry functionality was rewritten to improve its reliability and to support retrying on HTTP status codes. Previously, it only retried on some network failures. 98b5664
The option was renamed fromretriestoretryand it now accepts either a number of retries or an object with the ability to specify the number of retries, HTTP status codes and methods to retry on, and a function to decide how to retry. See the docs for more.
Migration:
-{ retries: 4 }→{ retry: 4 }
-{ retries: () => { … } }→{ retry: { retries: () => { … } } } - Breaking
Renamed the
.canceledproperty to.isCanceled. 00fdeea
Got version 9 is a massive release! Many new awesome features and we have pretty much fixed all the open issues regarding Got bugs on the issue tracker.
Got is a human-friendly and powerful HTTP request library for Node.js
Breaking changes
- Breaking
Requires Node.js 8.
You might ask, why not follow the Node.js LTS cycle and target Node.js 6. In short, async/await and WHATWG URL, which enabled us to simplify the codebase and reduce the dependency-tree considerably. Got v8 is a stable release, and you can continue using that if you need to support Node.js 6. - Breaking
The retry functionality was rewritten to improve its reliability and to support retrying on HTTP status codes. Previously, it only retried on some network failures. 98b5664
The option was renamed fromretriestoretryand it now accepts either a number of retries or an object with the ability to specify the number of retries, HTTP status codes and methods to retry on, and a function to decide how to retry. See the docs for more.
Migration:
-{ retries: 4 }→{ retry: 4 }
-{ retries: () => { … } }→{ retry: { retries: () => { … } } } - Breaking
Renamed the
.canceledproperty to.isCanceled. 00fdeea - Breaking
Dropped support for the
bodyoption being an Array whenform: true. dfe5b1c
The built-innew URLSearchParams()API doesn't support this either and it's a weird use-case. If you need support for this, just don't setform: trueand handle stringifying yourself. - Breaking
Got throws an error if
.pipe()was called after the response has been emitted.
This makes us sure you receive whole response in case flowing mode is on (#223).
Improvements
Fewer dependencies and smaller install size!
Got v9: install size
Got v8: install size
Request (latest): install size
The
timeoutoption was rewritten to be more reliable and flexible. You can now set a timeout for every phase of the request if you want, or just for the whole request. That's up to you. da4f236Added
got.extend()which lets you easily create instances of Got with some options overridden. bc41a49Added
got.create()which is a more advanced and powerful version ofgot.extend(). With this API, you can create your own niche-specific instance of Got, for example, an HTTP-client for GitHub. bc41a49Added a
beforeRequesthook. 107756fAdded
requestandresponseevents to the Promise API. e86aad7The
content-lengthheader is now also automatically set if thebodyoption is set to afs.createReadStreaminstance. 6e7a455You can now remove the default
user-agentheader by passing in'user-agent': nullas a header. e473a26The
bodyoption can now be any kind of object, not just a plain object. 7a49ce7
Bug fixes
Fixed a problem with the cache not working when using the
queryoption. 07a91ccLess unhandled errors (Hopefully none!). f621184
Headers are now correctly proxied when you pipe
got.stream(). 83bc44cLots of more bug fixes.
Other
100% code coverage! Doing this caught a couple of bugs, so definitely worth doing even if 100% doesn't mean bug-free.
The codebase was significantly refactored for better readability and maintainability. b54b680
Team
Welcome @szmarczak and @brandon93s as maintainers 🎉
Special shoutout to @jstewmon for helping us with many of the above improvements and fixes 🙌
All changes
- 8.x
8.2.0
19 Feb 2018No longer sets the default
accept-encoding: gzip,deflateheader if thedecompressoption isfalse.8.1.0
11 Feb 2018Add
throwHttpErrorsoption. 5a88943Allow calling of
got.streamvia options. b26c51e
8.0.3
20 Jan 20188.0.0
16 Nov 2017- Breaking
Uses HTTPS for protocol-less URLs (Previously it defaulted to
http). ae1a0fe - Breaking
Made the
useElectronoptionfalseby default. 33cbb6f Added a powerful
cacheoption. 3c79205 (Thanks to @lukechilds ✨)
Added a powerful
cacheoption. 3c79205 (Thanks to @lukechilds ✨)Added download/upload progress events. be7b802 (Thanks to @vadimdemedes 🌟)
Support for an object in the
agentoption. b9bf2e6- Breaking
Uses HTTPS for protocol-less URLs (Previously it defaulted to
http). ae1a0fe Excludes passed headers with values
nullorundefined. c5e2f8dUses
statusMessagereturned by endpoint. 01c2636- Breaking
Made the
useElectronoptionfalseby default. 33cbb6f Exposed
got.CancelError. b55f79eFixed
.cancel()when timeout exists. e31282d
- 7.x
7.1.0
30 Jun 2017Added
decompressoption. f9d19e3Fixed a bug with the Unix address parser. c0c6bcf
Added
decompressoption. f9d19e3Fixed a bug with the Unix address parser. c0c6bcf
Worked around an issue with New Relic and Promise subclasses. fe1fb8e
7.0.0
29 May 2017- Breaking
Changes stringifying options behavior. 51a3eaf
Setting thebodyoption to be an object to stringify is no longer possible without setting either theformoption for URL encoding or thejsonoption for JSON encoding. Previously, Got would use URL encoding by default, now it will throw an error. Since thejsonoption also means Got will decode a JSON response for you, setting both options totruewill encode the request as URL and decode the response as JSON. - Breaking
Now also redirects on 307, 308, 303 responses. b45896a
- Breaking
The
timeoutoption now applies to the whole request and we added ability to control the timeout of the individual phases. 7964f2c
Breaking changes
- Breaking
Changes stringifying options behavior. 51a3eaf
Setting thebodyoption to be an object to stringify is no longer possible without setting either theformoption for URL encoding or thejsonoption for JSON encoding. Previously, Got would use URL encoding by default, now it will throw an error. Since thejsonoption also means Got will decode a JSON response for you, setting both options totruewill encode the request as URL and decode the response as JSON. - Breaking
Now also redirects on 307, 308, 303 responses. b45896a
- Breaking
The
timeoutoption now applies to the whole request and we added ability to control the timeout of the individual phases. 7964f2c
Highlights
Added ability to cancel in-progress requests! 9ef7a5a
Added WHATWG URL support. f501fc2
Improve request retries by reducing the number of retries and making delays shorter. 14d0859
Only throws
ParseErrorwhen parsing fails on 2xx responses. c86706bNo longer throws HTTPError on 304 responses. 7b12b75
Added
protocolproperty to errors. 919703cAdded
urlproperty to errors. a287f8eIncludes response headers in errors, and redirect URLs in errors and the response. 8b4d06e
All changes
- 6.x
6.7.1
29 Dec 20166.7.0
29 Dec 2016This minor release fixes
timeoutbehaviour to correspond with readme:This minor release fixes
timeoutbehaviour to correspond with readme:Milliseconds to wait for a server to send response headers before aborting request with ETIMEDOUT error.
Before this release
ESOCKTIMEDOUTcan be thrown (which can lead to false-positive errors for keep-alive sockets).6.5.0
14 Sep 2016Add a redirect
urlproperty to the response objectAdd a
requestUrlproperty to the response object⬆️
get-streambumped to^2.3.0– which fixes some nasty encoding bugs
Add a redirect
urlproperty to the response objectAdd a
requestUrlproperty to the response object⬆️
get-streambumped to^2.3.0– which fixes some nasty encoding bugsFix location encoding
Detect formdata body and set content-type header
⬆️
unzip-responsebumped to^2.0.1– which fixesunexpected EOFerrorAllow non-plain object as request body
Changes
6.3.0
6 Apr 2016This option disables following redirects and
gotwill not treat them as errors:followRedirectoptionThis option disables following redirects and
gotwill not treat them as errors:const res = await got(`google.com`, {followRedirect: false}); res.statusCode === 302; // trueBy default this option is
true, so no major changes in code are needed.Changes
6.2.0
3 Mar 2016statusCodeandstatusMessageadded to ParseError object
6.1.2
28 Feb 2016Fixes errors on parsing empty JSON body
Fixes default user-agent to be RFS complaint
6.1.1
25 Jan 2016Fixes redirects with uppercased
methodoption
6.1.0
16 Jan 2016In
got@5we introducedretriesoption, which (as name says) retry request on every Error. For most errors this was right thing to do, but in caseENETUNREACHandENOTFOUNDretries are pointless.Non-retrieable errors
In
got@5we introducedretriesoption, which (as name says) retry request on every Error. For most errors this was right thing to do, but in caseENETUNREACHandENOTFOUNDretries are pointless.This version removes retries from such errors, so you will get instant error, when typo gets into configs.
Changes
6.0.0
7 Jan 2016This 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 MBto216 KB.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 MBto216 KB.For older Node.js versions we will still maintain
v5.xfor 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/awaitnicely.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.x
5.7.1
2 Nov 20165.7.0
1 Nov 2016Add
urlto responseAdd
requestUrlto response in streaming modeAllow non-plain object as request body
This is last release of
5.xbranch (which compatible with old versions of Node.JS). In this release we pulled all fixes (only UTF in headers is not cherry-picked):Add
urlto responseAdd
requestUrlto response in streaming modeAllow non-plain object as request body
Fixed unexpected EOF when decompressing content
Detect formdata body and set content-type header
Add a
requestUrlproperty to the response objectAdd redirect url to response object
🎃 Happy Halloween!
5.4.1
25 Jan 2016Reading the note…
5.4.0
16 Jan 2016Reading the note…
5.3.2
13 Jan 2016Reading the note…
5.3.1
12 Jan 2016Missing exception in helper methods for stream mode.
Fixed piping
responseinresponseevent for stream mode.
5.3.0
20 Dec 2015Reading the note…
5.2.1
15 Dec 2015Reading the note…
5.2.0
2 Dec 2015Reading the note…
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.