This repository was archived by the owner on Jan 21, 2026. It is now read-only.
fix(deps): update dependency got to v10#1162
Merged
kjin merged 1 commit intogoogleapis:masterfrom Dec 3, 2019
Merged
Conversation
kjin
approved these changes
Dec 3, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^8.0.0->^10.0.0^9.3.2->^10.0.0Release Notes
sindresorhus/got
v10.0.1Compare Source
jsonoption withgot.stream.post2ec5c4dv10.0.0Compare Source
We're excited to announce Got 10! 🎉 This release has been in the works for almost a year and has been a major undertaking. Got was fully rewritten in TypeScript, which helped us catch many bugs and will give us more confidence in the codebase going forward. Got is now faster and much more stable. We also fixed a huge amount of bugs. Big thanks to everyone that helped make this release possible. 🙌
If you find Got useful, you might want to sponsor the Got maintainers.
Note: Some HTTP agents like
https-proxy-agentandagentkeepaliveare not compatible with Node.js 10 and hence not compatible with Got as Got takes advantage of some Node.js 10-only APIs.Breaking
633651f- Why: This is so that we can use
stream.pipelinefor more reliable stream handling. Node.js 8 will be out of LTS at the end of this month anyway.urlargument92bc808- Why: To reduce ambiguity. It was not clear from just reading the code what it would default to.
- Migrate:
queryoption tosearchParamsand make it stricterb2236635376216518f0f5- Why: To get closer to the
window.fetchnaming in the browser.- Migrate:
baseUrloption withprefixUrl(#829)0d534ed- Note: We also made it stricter to reduce ambiguity. The Got
urlargument now cannot be prefixed with a slash when this option is used.- Why: We renamed it to make it clear that it doesn't do any URL resolution.
- Migrate:
jsonoption to accept an object instead of a boolean and to only be responsible for the request, not the response (#704)a6a7d5a- Note: You now set the request body in this option instead of the
bodyoption when you want to send JSON. This option also no longer sets the response type to JSON. You either call the.json()method or specify theresponseTypeoption for that.- Why: Many people were confused how
{json: true}worked and they also complained that they could not set the request/response type individually.- Migrate:
responseTypeoption instead ofencodingto get a Buffer (#940)6cc3d9f- Why: Previously, you would pass
{encoding: null}to get a Buffer, but this was confusing. You now use{responseType: 'buffer'}instead.- Tip: You can also use
got(…).buffer();.- Migrate:
POSTautomatically when specifyingbody(#756)e367bdb- Why: We're trying to reduce the amount of magic behavior.
- Migrate:
retries.retryoption was split intoretries.limitandretries.calculateDelayb15ce1d- Migrate:
got(…, { retry: { - retries: 2 + limit: 2 } });got(…, { retry: { - retries: iteration => iteration < 2 + calculateDelay: ({attemptCount}) => attemptCount < 2 } });undefinedinstead ofnullto omit a header (https://github.com/sindresorhus/got#headers)518f0f5- Why: We're trying to reduce the use of
null.- Migrate:
got(…, { headers: { - 'user-agent': null + 'user-agent': undefined } });.fromCacheto.isFromCache(#768)b5e443bstreamoption toisStream518f0f5- Why: To make it clearer that it's a boolean and that it doesn't expect a stream to be passed in.
- Migrate:
user-agentheader (#911)95bed1e-
got/9.6.0 (https://github.com/sindresorhus/got)→got (https://github.com/sindresorhus/got)- Why: Importing package.json to get the version caused a lot of problems. And you should ideally set your own
user-agentheader anyway.got.create()518f0f5- You can achieve the same thing with
got.extend()now.got.mergeInstances()518f0f5- Use
gotInstance.extend(...gotInstances)instead..optionsand.responseproperty (#773)6eaa81b- Migrate:
8eaef94- Note:
got.mergeInstances(...instances)is deprecated. UseinstanceA.extend(instanceB)instead.- Migrate:
Enhancements
- Why: This means we can provide our own type definitions and we can be more confident when working on the Got codebase and produce less bugs.
Huge thanks to @pmmmwh, @LinusU, @vladfrangu, @mastermatt, and everyone else that helped us with this rewrite. 🙌
d5d2e6fcd12351contextoption for storing custom metadata across request and hooks (#777)3bb5aa7e9c01e0maxRedirectsoption (#914)0c505b0b7ead5fmethodRewritingoption (#942)b82358ftough-cookiefor handling cookies (#882)518f0f58874a4500e5fd5beforeRedirecthook (#812)355789692b1005.isFromCacheproperty to the stream API (#768)b5e443btimeoutoption can now be modified in hooksd520a3aprefixUrloption can now be modified in hooks (#867)518f0f5URLSearchParamsinstances mergeable (#734)95c7c2cFixes
afterResponsehook (#775)e2054cdportnot being reset on redirect (#729)ada58610501e00retryoption value when specifying a number (#809)9c04a7cbeforeErrorhook134c9b74faf5c7b0dfc95518f0f5204 No Contentwhen parsing response (#925)518f0f5518f0f5afterResponsehook should triggerbeforeRetryhook (#918)518f0f5518f0f5518f0f5cd11a50Docs
retrybehavior5e6782aprefixUrlbehavior (#943)f008bc9retryoption doesn't work with streams9088866Stream.pipeline()when using the stream API06afb27global-agent(#822)ca8c560TimeoutError.timingsproperty8fa18f496ea75fAll commits
v9.6.0Compare Source
inithook (#683)677d0a4beforeErrorhook (#696)29ffb44v9.5.1Compare Source
203dadcd136e61d136e61v9.5.0Compare Source
5d20a43a1eadfev9.4.0Compare Source
9f3a09933b838fsockettimeout on error.c8e358fv9.3.2Compare Source
d8dd88107b3ce5v9.3.1Compare Source
urlargument when it's an object.191e00acontent-lengthheader when upload body size isnull.311b184v9.3.0Compare Source
b392f60beforeRedirect,beforeRetry, andafterResponsehooks.325409cfbaaa2abodyproperty inHTTPError.fdc0fa6a07b2be25f18bev9.2.2Compare Source
Locationredirect URLs. (#605)7ae69393ad3950got.extend(). (#608)292f78av9.2.1Compare Source
b8480f35f191b9v9.2.0Compare Source
8191dafcookieJaroption. (#596)eedebc978a56eccontent-lengthheader to zero when doing a PUT request with no body. (#584)9a966ecqueryoption when it's a string. (#589)f23f350responseobject. (#592)267cb66HTTP trailers are not supportederror. (#598)e66a6b6v9.1.0Compare Source
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)f0b190abaseUrloption. (#579)c901c463d98b9bqueryoption to be aURLSearchParamsinstance. (#565)b8a086fa3e77deget-streamto 0.4.0 for improved handling of stream edge-cases. (#578)45d3a60methodoption. (#547)ecf3180agentoption withgot.extend(). (#577)2ffcd49got.stream(). (#550)ae5b114eb652f8v9.0.0Compare Source
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.
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.
98b5664The option was renamed from
retriestoretryand 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: () => { … } } }.canceledproperty to.isCanceled.00fdeeabodyoption being an Array whenform: true.dfe5b1cThe 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 setform: trueand 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).
Improvements
- Got v9:
- Got v8:
- Request (latest):
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.da4f236got.extend()which lets you easily create instances of Got with some options overridden.bc41a49got.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.bc41a49beforeRequesthook.107756frequestandresponseevents to the Promise API.e86aad7content-lengthheader is now also automatically set if thebodyoption is set to afs.createReadStreaminstance.6e7a455user-agentheader by passing in'user-agent': nullas a header.e473a26bodyoption can now be any kind of object, not just a plain object.7a49ce7Bug fixes
queryoption.07a91ccf621184got.stream().83bc44cOther
b54b680Team
Welcome @szmarczak and @brandon93s as maintainers 🎉
Special shoutout to @jstewmon for helping us with many of the above improvements and fixes 🙌
All changes
Renovate configuration
📅 Schedule: "after 9am and before 3pm" (UTC).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻️ Rebasing: Whenever PR is stale, or if you modify the PR title to begin with "
rebase!".🔕 Ignore: Close this PR and you won't be reminded about these updates again.
Newsflash: Renovate has joined WhiteSource, and is now free for all use. Learn more or view updated terms and privacy policies.