NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #1225 most downloaded on npm
Human-friendly and powerful HTTP request library for Node.js
Last release 1 months ago
30 Aug 2026
Release timing varies
gaps range from 8 days to 3 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
13 years old
201 releases · first in 2014
Experimental HTTP2 support. (#583) 8191daf
cookieJar option. (#596) eedebc9content-length header to zero when doing a PUT request with no body. (#584) 9a966ecquery option when it's a string. (#589) f23f350response object. (#592) 267cb66HTTP trailers are not supported error. (#598) e66a6b6https://github.com/sindresorhus/got/compare/v9.1.0...v9.2.0
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
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) f0b190abaseUrl option. (#579) c901c46query option to be a URLSearchParams instance. (#565) b8a086fget-stream to 0.4.0 for improved handling of stream edge-cases. (#578) 45d3a60method option. (#547) ecf3180agent option with got.extend(). (#577) 2ffcd49got.stream(). (#550) ae5b114https://github.com/sindresorhus/got/compare/v9.0.0...v9.1.0
One column per quarter.
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 tracke
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
retries to retry and 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: () => { … } } }.canceled property to .isCanceled. https://github.com/sindresorhus/got/commit/00fdeea9395225f1ca0f25230f5dfcc4010e3af0body option being an Array when form: true. https://github.com/sindresorhus/got/commit/dfe5b1cfd762d4ccf4bf53ef2c1c0b31500baa30
The built-in new URLSearchParams() API doesn't support this either and it's a weird use-case. If you need support for this, just don't set form: true and handle stringifying yourself..pipe() was called after the response has been emitted.
This makes us sure you receive whole response in case flowing mode is on (#223).timeout option 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. https://github.com/sindresorhus/got/commit/da4f23699dead63f17b5e27f9cadd9e4cb95e9a9got.extend() which lets you easily create instances of Got with some options overridden. https://github.com/sindresorhus/got/commit/bc41a49f14f16374766bfe8f7f8ee59365794d9cgot.create() which is a more advanced and powerful version of got.extend(). With this API, you can create your own niche-specific instance of Got, for example, an HTTP-client for GitHub. https://github.com/sindresorhus/got/commit/bc41a49f14f16374766bfe8f7f8ee59365794d9cbeforeRequest hook. https://github.com/sindresorhus/got/commit/107756fc28dce579c521b15248f8bba730ae9e54request and response events to the Promise API. https://github.com/sindresorhus/got/commit/e86aad7cf17edb596d9ed362d610960529d505c6content-length header is now also automatically set if the body option is set to a fs.createReadStream instance. https://github.com/sindresorhus/got/commit/6e7a4557d7568fed0677d146bdbd655d60d4fd92user-agent header by passing in 'user-agent': null as a header. https://github.com/sindresorhus/got/commit/e473a26de25f8cc8fa34f5285f52aa01bb6065ebbody option can now be any kind of object, not just a plain object. https://github.com/sindresorhus/got/commit/7a49ce7b72e3c482fd66f1d3a30ec39098d8e618query option. https://github.com/sindresorhus/got/commit/07a91cc94db41d4d797a46e45e1834ef65818a43got.stream(). https://github.com/sindresorhus/got/commit/83bc44c536f0c0ffb743e20e04bf569c51fa5d69Welcome @szmarczak and @brandon93s as maintainers 🎉
Special shoutout to @jstewmon for helping us with many of the above improvements and fixes 🙌
https://github.com/sindresorhus/got/compare/v8.3.2...v9.0.0
Fix Got throwing an error in some cases when trying to pipe one got.stream into another one. https://github.com/sindresorhus/got/commit/7ac705f831658c
Fix Got throwing an error in some cases when trying to pipe one got.stream into another one. https://github.com/sindresorhus/got/commit/7ac705f831658c11b4a6fca6c6b21035ef8db3e8
No longer overrides accept-encoding header if already provided. https://github.com/sindresorhus/got/commit/81f2537e6950643e986c09c182dbf29d5fcee8e2
accept-encoding header if already provided. https://github.com/sindresorhus/got/commit/81f2537e6950643e986c09c182dbf29d5fcee8e2content-length header when using form-data if not already set. https://github.com/sindresorhus/got/commit/de9514d897ca58ec70bbf82acc52e43b44cca870https://github.com/sindresorhus/got/compare/v8.3.0...v8.3.1
Fixed socket connect memory leak. https://github.com/sindresorhus/got/commit/13d6b68ba02413374519f490d75741a427d705ad
connect memory leak. https://github.com/sindresorhus/got/commit/13d6b68ba02413374519f490d75741a427d705adhttps://github.com/sindresorhus/got/compare/v8.2.0...v8.3.0
No longer sets the default accept-encoding: gzip,deflate header if the decompress option is false.
No longer sets the default accept-encoding: gzip,deflate header if the decompress option is false.
https://github.com/sindresorhus/got/compare/v8.1.0...v8.2.0
Add `throwHttpErrors` option. https://github.com/sindresorhus/got/commit/5a8894363172f1d39761447b93e0496b363782f0
throwHttpErrors option. https://github.com/sindresorhus/got/commit/5a8894363172f1d39761447b93e0496b363782f0got.stream via options. https://github.com/sindresorhus/got/commit/b26c51e50f1657b702cb738561239654f5a4cbd9https://github.com/sindresorhus/got/compare/v8.0.3...v8.1.0
Nothing published for this version
Fix browser usage. https://github.com/sindresorhus/got/commit/30c39bc1c3042a80ed3f6752677e0ab42cb1ca98
url is UTF-8 encoded. https://github.com/sindresorhus/got/commit/4f5e6bfc8f4ed83b3e2c4c03fe20ea706543cfc9https://github.com/sindresorhus/got/compare/v8.0.1...v8.0.2
Correctly forwards stream errors. https://github.com/sindresorhus/got/commit/974473aadb2f43a7feacfd0e9246af8690ac016e
https://github.com/sindresorhus/got/compare/v8.0.0...v8.0.1
[Breaking change] Uses HTTPS for protocol-less URLs (Previously it defaulted to http). https://github.com/sindresorhus/got/commit/ae1a0fedf202ac2adcac…
cache option. https://github.com/sindresorhus/got/commit/3c7920507fae88a5f53d0640b5116fa34a5ed829 (Thanks to @lukechilds ✨)agent option. https://github.com/sindresorhus/got/commit/b9bf2e6bfcb0ccdb8761a4ce1b04e80a422234dehttp). https://github.com/sindresorhus/got/commit/ae1a0fedf202ac2adcac8f2d3e0d2ef40fe52d37null or undefined. https://github.com/sindresorhus/got/commit/c5e2f8d456c72dd5ce6acf73a12a80c700a26c83statusMessage returned by endpoint. https://github.com/sindresorhus/got/commit/01c26364d9e34c60cf0cf81e331271ee4fc11d1auseElectron option false by default. https://github.com/sindresorhus/got/commit/33cbb6ffcf4cf9d8a735531fcc9ca81b4196efd4got.CancelError. https://github.com/sindresorhus/got/commit/b55f79e99d11d11d438f64dd8499dcee964d1c5d.cancel() when timeout exists. https://github.com/sindresorhus/got/commit/e31282dfd3402e7581bc7921746a62b35e9a8a31https://github.com/sindresorhus/got/compare/v7.1.0...v8.0.0
Added `decompress` option. https://github.com/sindresorhus/got/commit/f9d19e333413396a40328f28fd56b0e9fa26d5ed
decompress option. https://github.com/sindresorhus/got/commit/f9d19e333413396a40328f28fd56b0e9fa26d5edArray with the json option. https://github.com/sindresorhus/got/commit/1cf2bbf8cf1d26a4449171a4bbb689310dc9036bhttps://github.com/sindresorhus/got/compare/v7.0.0...v7.1.0
Changes stringifying options behavior. https://github.com/sindresorhus/got/commit/51a3eafbdfa2e98e36a6231cd16c80ca16b6523b Setting the body option to
body option to be an object to stringify is no longer possible without setting either the form option for URL encoding or the json option for JSON encoding. Previously, Got would use URL encoding by default, now it will throw an error. Since the json option also means Got will decode a JSON response for you, setting both options to true will encode the request as URL and decode the response as JSON.timeout option now applies to the whole request and we added ability to control the timeout of the individual phases. https://github.com/sindresorhus/got/commit/7964f2cdef36d98d498d7cc2dfe811c5291aaaf5ParseError when parsing fails on 2xx responses. https://github.com/sindresorhus/got/commit/c86706bd23277ba033abefaf92a9c8fa69f78eeeprotocol property to errors. https://github.com/sindresorhus/got/commit/919703cd8e9ba944753457d7f6b0ca4ecd94748durl property to errors. https://github.com/sindresorhus/got/commit/a287f8ec8a6498d9d5e1037255b36946f5c0c97bhttps://github.com/sindresorhus/got/compare/v6.7.1...v7.0.0
Nothing published for this version
This minor release fixes timeout behaviour to correspond with readme:
This minor release fixes timeout behaviour to correspond with readme:
Milliseconds to wait for a server to send response headers before aborting request with ETIMEDOUT error.
Before this release ESOCKTIMEDOUT can be thrown (which can lead to false-positive errors for keep-alive sockets).
Nothing published for this version
Nothing published for this version
Nothing published for this version
Add requestUrl to response in streaming mode
requestUrl to response in streaming mode (#230)new Buffer() => Buffer.from() 5888ca7aa1ca982caac27e7796e225f70ded68a4url to response (#236)timed-out updated to ^3.0.0Add a redirect url property to the response object
url property to the response object (#191)requestUrl property to the response object (#205)get-stream bumped to ^2.3.0 – which fixes some nasty encoding bugsunzip-response bumped to ^2.0.1 – which fixes unexpected EOF errorhttps://github.com/sindresorhus/got/compare/v6.3.0...v6.5.0
This option disables following redirects and got will not treat them as errors:
followRedirect optionThis 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.
https://github.com/sindresorhus/got/compare/v6.2.0...v6.3.0
26a499c0332ae673c89ca6bb680cf04e11965a66 statusCode and statusMessage added to ParseError object
statusCode and statusMessage added to ParseError object45a636c6c22c2f7c9ffc14c78b8679d23485f9d2 fixes errors on parsing empty JSON body
f9ef29a3fc91708e5c4635f0c2afa1b781fd39b8 fixes redirects with uppercased method option
method optionIn `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 EN
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.
https://github.com/sindresorhus/got/compare/v6.0.0...v6.1.0
Nothing published for this version
Nothing published for this version
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 fold
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.
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".
$ npm install --save got@6
https://github.com/sindresorhus/got/compare/v5.3.0...v6.0.0
Nothing published for this version
Nothing published for this version
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 ch
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):
url to response (#236)requestUrl to response in streaming mode (#230)requestUrl property to the response object (#205)🎃 Happy Halloween!
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
43a6ea5cdf8f22225df951e331f12934cc466b3c Missing exception in helper methods for stream mode.
response in response event for stream mode.https://github.com/sindresorhus/got/compare/v5.3.0...v5.3.1
59aa1d3a1da88fe46a2e3fa85f4c194d3fa6b743 Error is passed to retries function as well
retries function as wellhttps://github.com/sindresorhus/got/compare/v5.2.0...v5.3.0
Nothing published for this version
54bd6f5bbad9590be6ffc7baf004c381bf1ea7a9 default intervals between delays decreased - now they are around 1s, 2s, 4s, 8s, etc...
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
});
https://github.com/sindresorhus/got/compare/v5.1.0...v5.2.0
5205e7260f6082fe567f505be4aa15249c2c74a5 body option now accepts Stream1 streams
body option now accepts Stream1 streamscontent-length and accept headers now can be falsy values ('' or 0 for example)response property is now non-enumerable in error objectundefined value of code property in error removedhttps://github.com/sindresorhus/got/compare/v5.0.0...v5.1.0
We added retries on network failures with noisy exponential backoff. By default got will try five times, before returning error.
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.
$ npm install --save got@5
response event on error (in stream mode) (#110)auth option passed in url string (#106)response eventhttps://github.com/sindresorhus/got/compare/v4.2.0...v5.0.0
e944467ed5e54ac37e19d924f17e7a1f93ebf01f improves error message on invalid JSON
https://github.com/sindresorhus/got/compare/v4.1.1...v4.2.0
bdc1bfb2b849bbb914c20520e12357df92be1e58 fixes crashes on RequestError in Promise mode
https://github.com/sindresorhus/got/compare/v4.1.0...v4.1.1
7bea9c4d33ca4bbc01b44e28d4aefca2d170c680 If body is a plain Object, it will be stringified and sent as application/x-www-form-urlencoded.
body is a plain Object, it will be stringified and sent as application/x-www-form-urlencoded.https://github.com/sindresorhus/got/compare/v4.0.0...v4.1.0
Major release with lots of new stuff! Enjoy!
Major release with lots of new stuff! Enjoy!
got without callback now returns a promise instead of a stream. The stream API now lives under stream property (look at the end of section).
got('todomvc.com')
.then(function (res) {
console.log(res.body);
})
.catch(function (err) {
console.error(err.response.body);
});
In resolve handler you receive a http.response object with body as additional property.
In reject handler we provide an Error object. Unless Error type is RequestError, it will have response property with body property.
This API will be a huge advantage with co and Generators:
var co = require('co');
co(function * () {
try {
var response = yield got('todomvc.com');
console.log(response.body);
} catch (err) {
console.error(err);
}
});
You can go even further with destructuring and await from ES7:
async function () {
try {
var {body} = await got('todomvc.com');
console.log(body);
} catch (err) {
console.error(err);
}
}
Stream support is preserved, but now under the streams property:
got.stream('todomvc.com').pipe(process.stdout);
Before 4.0.0 got had one Error class (GotError) with nested stack traces and custom error messages. This was a nice concept, but in production use some edge cases popped out:
error.nested.nested).url.So we decided to review Errors in new version. In 4.0.0 got now have multiple Error classes for different situations: RequestError, ReadError, ParseError, HTTPError and MaxRedirectsError.
In addition to message and code properties from the original error, the new errors types also provide additional properties (host, hostname, path and method) for logging and debugging.
Custom agent was removed. This returns the ability to configure or replace global Agent, but also returns low maxSockets value in NodeJS 0.10.x. To fix this you can add this lines at the top of your app (not in reusable modules!):
require('http').globalAgent.maxSockets = Infinity;
require('https').globalAgent.maxSockets = Infinity;
https://github.com/sindresorhus/got/compare/v3.3.1...v4.0.0
312c80d82cd0472d009914fe8ffeebf06637e9c3 Don't parse JSON on 204 responses. #78
https://github.com/sindresorhus/got/compare/v3.3.0...v3.3.1
87d98e1f46103044b2152886435a1b97203add32 Added content-length header in requests with body.
content-length header in requests with body.pathname option, if no path is present.https://github.com/sindresorhus/got/compare/v3.2.0...v3.3.0
json option now sets Accept header to application/json (if it was not specified in headers)
json option now sets Accept header to application/json (if it was not specified in headers)
https://github.com/sindresorhus/got/compare/v3.1.0...v3.2.0
error event now have additional body and response arguments in callback:
error event now have additional body and response arguments in callback:
got('http://giggle.com')
.on('error', function (error, body, response) {
console.log(error, body, response);
});
https://github.com/sindresorhus/got/compare/v3.0.0...v3.1.0
This event fired before any redirect with response and nextOptions objects. You can access cookies and store them to be passed with next request in ne
redirect eventThis event fired before any redirect with response and nextOptions objects. You can access cookies and store them to be passed with next request in nextOptions.
got('cookie.com')
.on('redirect', function (res, nextOptions) {
nextOptions.headers.cookie = cookie(res);
});
As rfc2616 HTTP 1.1 says:
If the 302 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.
Now got will not auto-redirect you with unsafe methods (like POST or DELETE), which can cause lots of troubles.
https://github.com/sindresorhus/got/compare/v2.9.0...v3.0.0
Nothing published for this version
Nothing published for this version
url now throws error if not string or object 6b015692aa9dd42f69085c24be5e4bdf450f22de
url now throws error if not string or object 6b015692aa9dd42f69085c24be5e4bdf450f22debody option type a0913bc13c337c03ae9312fe4d851e9a367885aaurl now accepts http.request options as first argument 47da1181a52501fd30a14ddb43f576043d2bc711query option added 53df1ca251fbc0299916d3309ff53df065e97fbehttps://github.com/sindresorhus/got/compare/v2.8.0...v2.9.0
Nothing published for this version
Don't mutate the user-supplied options object ae73837301b2b50664e732d2b5bf93847b2b4cb3
2.0.0 - which uses backported Agent from Node core c06d741131cd71a0cc9ca38a960ef5469cc3c1ce
Connection: close header instead of Connection: keep-alive. maxSockets is now Infinity always - if you want different value, pass null or new Agent instance.https://github.com/sindresorhus/got/compare/v2.7.2...v2.8.0
Fixed absent nested error on parse error of response.
Fixed absent nested error on parse error of response.
https://github.com/sindresorhus/got/compare/v2.7.1...v2.7.2
Your coding agent can read these notes before it upgrades. Set up the MCP server →