Repository navigation
chore(deps): update dependency got to v16 - #630
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
Author
|
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Note
This PR body was truncated due to platform limits.
This PR contains the following updates:
^11.5.0→^16.0.0Release Notes
sindresorhus/got (got)
v16.1.0Compare Source
This release is the result of a large bug hunt. Many of the fixes make Got match its documented behavior, so you may notice some of them:
method, a negative or fractionalmaxRedirectsorretry.limit, aprefixUrlwith a query string or fragment, and ahandlersentry that is not a function.body,json, orformoption now rejects writes, as documented.responseevent now only fires for the final response, not for every retry attempt.got.extend({body})(andjson,form) no longer sends the payload with every request of the instance. Payloads are never merged with defaults.instance.extend()now inherits the parent'smutableDefaults, likegot.extend(instance).HEADrequest is no longer changed toGETon a301,302, or303redirect.response.bodyno longer keeps a leading UTF-8 byte order mark, and JSON with a byte order mark now parses.Improvements
headers6fffc9eTimings,DnsCacheLookup, andDnsCacheOptionstypesd012d1deccaacaFormDatabodies by re-serializing them instead of failing90c6ec1x-gzipcontent coding and stacked content codings5550a79Fixes
d3c549c78bf3946bbc7f4602b179687b5c84ea02b8b6522f39348ad6c6863863bbc37b91dc48611621cdtimeout.requestrestarting on each redirect, and several timeout phase edge cases9cd2ee6df33cdb4e4c583795234f0f1263dfollowRedirectonce per response, and keepContent-Lengthcorrect when a hook replaces the body1febf3ca2b3d901d64f7c60b48afInfinitytimeouts firing at once or throwing724ebc2Retry-Aftervalues andcalculateDelayforafterResponseretriesfe58b8c0193605ae5521f7c1cda38bbc79f1a56d36d012d1dpaginateon real-worldLinkheaders, and several pagination option and limit edge casesbd2dee01e61807602b179f98d0e1c8419e4526a988557e61f4712e5ba4a50adb65e533afterResponse,beforeRequest, andbeforeCachehook edge cases45c201cc1cf0f8850e49ba4a50ad863cf30494279bc36ad51c409a843c6eaf1f658d3edbd83dfServerResponse348e114dc929bddc56e4bc930cd9a9a754fDataViewbyte ranges, upload error classification, progresstotalforContent-Length: 0, and cancelling WebReadableStreambodies2a66686d1cb0510238069b57120c200bc858f44d81687eb7d30023f75548b00bec5da6bcc0b019348ad6a9a754f7b133693bd0486d2726560e537c760b62a0129d88dRequestErrorinstead of the real error class, and other error cause edge casesc8419e49d61a375ccac5871f4e0eb3dc5c64ea02b8d012d1d784bbd2d5cd5e4cfce7b67c833b8c59692b88eeb130c17a8bc788ac9a4176b6v16.0.0Compare Source
Breaking changes
http2-wrapperdependency (#2464)1e157c4GOAWAYretirement, request and response trailers, informational (1xx) responses, abort signals, response caching, IPv6 authorities, andh2cthroughh2session.agent.http2is no longer an agent slot. It is only an opt-out flag now: passfalseto skip session pooling. Passing an agent instance throws.response.statusCodeinstead ofresponse.headers[':status'].agent.httpscombined withhttp2: truemakes Got use the native HTTP/1.1 path, because the built-in session pool does not support custom HTTPS agents.http2-wrapper. It was very buggy anyway.options.requestreturns a request or response, it controls the transport and the HTTP/2 client is bypassed. Returnundefinedto fall back to Got's own transport.cacheable-lookupdependency (#2463)bfc400bdnsCache: truenow uses Got's own cache. The option accepts any object with alookupfunction and an optionalclear(hostname?)function, so an existingCacheableLookupinstance still works if you keep the dependency yourself.verbatimaddress ordering fromdns.lookup().beforeRequesthook, anafterResponseretry, or a pagination step that moves the request to a different origin now strips credentials and drops the body (#2465)dd3b295authorization,cookie,cookie2,host, andproxy-authorizationare removed, URL credentials are dropped, and an unchanged body is cleared. Set the headers or body explicitly inside the hook if you want them to cross the origin boundary.urlor throughprefixUrl.copyPipedHeadersno longer copies credentials1d233baauthorization,cookie,cookie2,set-cookie, andset-cookie2are now omitted along withhost, the hop-by-hop headers, and anything nominated byConnection/Proxy-Connection. Pass credentials explicitly inheaderswhen the upstream is trusted.searchParameters,followRedirects, andauthoption stubs1d233baUnexpected option: ….OptionsOfUnknownResponseBodytype1d233baStrictOptions.Improvements
QUERYHTTP method (#2466)e3924aagot.query()andgot.stream.query().QUERYis safe and idempotent, so it is retried by default and keeps a replayable body across301and302redirects as well as307and308. It is not stored by the built-in cache, because correctQUERYcaching needs cache keys that include the request content.allowGetBodynow also works over HTTP/21e157c4timeout.socketnow applies during HTTP/2 TLS negotiation and session setupc6bbb8arequesttimeout. It now produces a realsockettimeout and no longer counts DNS lookup time.cacheable-lookupandhttp2-wrapperbfc400b1e157c4Fixes
request.end()instead of failing the request (#2470)67919b2Retry-After: 0instead of falling back to the backoff delay (#2471)d35ce87c6bbb8aerror.response.bodyis now complete, decompressed, and decoded with the configuredencoding, and a decoding failure no longer masks the original error.followRedirect: falsec6bbb8aset-cookiec6bbb8agot.streamfinalizing the response before theresponseevent and before piped server response headers are setc6bbb8astrictContentLengthcounting bytes from responses that were not actually decompressedc6bbb8ahooks.beforeCachealong with the other hook arrays on non-mutable defaults1d233baprefixUrlis changed to a same-origin value, and treat credentials inprefixUrlas explicitdd3b295Migration guide
HTTP/2
Remove
http2-wrapperfrom your code. Got's HTTP/2 client is built in.Before:
After:
To opt out of HTTP/2 session pooling for a request, set
agent.http2tofalse.If you need an HTTP/2 proxy, keep using
http2-wrapperthrough therequestoption. Returning a request fromrequestbypasses Got's HTTP/2 client.h2cThe
h2sessionhook example no longer needsrequestorhttp2.Before:
After:
dnsCachednsCache: truekeeps working and now uses Got's built-in cache. If you depend oncacheable-lookupspecific options, install it yourself and pass the instance:Cross-origin hooks
If a
beforeRequesthook, anafterResponseretry, or a pagination step sends the request to a different origin, set the headers and body you want to keep explicitly:copyPipedHeadersCredentials are no longer forwarded from a piped request. Pass them explicitly when the upstream is trusted:
v15.1.0Compare Source
allowAbsoluteUrlsoption (#2462)1c88e88v15.0.7Compare Source
aee9249v15.0.6Compare Source
searchParamssetter dropping the value when a URL is set (#2454)5772bf2v15.0.5Compare Source
74e3167v15.0.4Compare Source
11a2202v15.0.3Compare Source
ReadErroron responses withoutContent-Length071ea07v15.0.2Compare Source
b170125v15.0.1Compare Source
20633bcv15.0.0Compare Source
Breaking changes
b933476a06ac6cpromise.cancel()is gone. Use thesignaloption withAbortControllerinstead.isStreamoptionc241c6cgot.stream()directly.FormDataglobal670b228FormDataglobal directly (available in Node.js 18+).responseType: 'buffer'returnsUint8Arrayinstead ofBuffer309e36dresponse.rawBodyandpromise.buffer()now return aUint8Array.Bufferis a subclass ofUint8Array, so most code will continue to work, but strict type checks will need updating.strictContentLengthdefaults totrue08e9dffContentLengthMismatchErrorby default ifContent-Lengthdoesn't match the actual body size. Set{strictContentLength: false}to restore the old behavior.retry.enforceRetryRulesdefaults totrue9bc8dfbcalculateDelayfunctions are now only called when a retry is actually allowed bylimit,methods,statusCodes, anderrorCodes. If yourcalculateDelaywas previously used to override retry eligibility unconditionally, set{retry: {enforceRetryRules: false}}.8e392f3{copyPipedHeaders: true}to re-enable. Hop-by-hop headers are never copied even when enabled (RFC 9110 §7.6.1).urlremoved from public options objects87de8d6urlproperty is no longer present on the options object passed to hooks. Useresponse.urlorrequest.requestUrlinstead.5fccaabImprovements
text/jsonbodies incrementally for lower peak memory usagec9a95b1uploadProgressnow emits granular per-chunk events forjsonandformrequest bodies13c889dMigration guide
Replace
promise.cancel()withAbortControllerBefore:
After:
Replace
isStream: truewithgot.stream()Before:
After:
Replace
form-data/form-data-encoderwith nativeFormDataBefore:
After:
Update
Bufferusage toUint8Arrayresponse.rawBodyandpromise.buffer()now returnUint8Arrayinstead ofBuffer.Before:
After:
If you need
Buffer-specific APIs, wrap withBuffer.from(data.buffer, data.byteOffset, data.byteLength).strictContentLengthis now on by defaultIf you send requests where the
Content-Lengthheader might not match the actual body size, opt out:retry.enforceRetryRulesis now on by defaultIf your
calculateDelayfunction was overriding retry eligibility (e.g. retrying on methods or status codes outside the defaults), opt out:Piped header copying is now opt-in
If you pipe streams into Got and rely on automatic header forwarding (e.g.
Content-Type), re-enable it:300 and 304 responses are no longer followed
If your code depended on Got auto-following 300 Multi-Choice or handling 304 Not Modified as a redirect, you now need to handle them yourself in an
afterResponsehook or checkresponse.statusCodemanually.v14.6.6Compare Source
4d5168cb65b0e1, where it incorrectly auto-closed streams for empty PATCH/DELETE/OPTIONS when using streams. This broke the documented use case of piping data to a got stream for these methods.v14.6.5Compare Source
got.extend()withresponseTypeoptionf7ab6e9v14.6.4Compare Source
dnsLookupoption type to accept Node.jsdns.lookup47c3155v14.6.3Compare Source
fb03d8461d5e3bv14.6.2Compare Source
0a16a9cv14.6.1Compare Source
v14.6.0Compare Source
Improvements
beforeCachehook1c3a041retryCounttobeforeRequesthook context91cdc48HTTPErrormessage to include method and URL6dd7574ecf56333e2a781beforeErrorhook1c71194449833af5c54a3strictContentLengthoption4206f0ehttps.secureOptionsoption7ec1714copyPipedHeadersoption to control automatic header copying from piped streamsd83daddstream.isReadonlyproperty to detect read-only streams030dfbbFixes
398c11af004564beforeRetryhooksbf84d36beforeErrorhook not being called forERR_UNSUPPORTED_PROTOCOLerrorfb86418prefixUrlin hooks9725fbd1e497812527bf6content-lengthwhen piping decompressed responses30b3b796ae3e7fe09a9bd6a544a3afterResponsehook validation to allownullbody values60a44193d66aectimings.endbeing undefined when stream is destroyed before completion4e75679e5659d4Meta
I managed to get it almost down to zero issues! 🎉
v14.5.0Compare Source
retry.enforceRetryRulesoption to fix statusCodes/limit bypassing7c0aee6serverNameHTTPS optioncdaab63preserveHooksoption forretryWithMergedOptions1abeba4IterableandAsyncIterableas request bodyb65b0e12ab94fda2812dedownloadProgressfiring for redirect responses9ec6ff0e899c07falseas agent value6961284d1d4ed223d0b6b724d592dc4f1e3v14.4.9Compare Source
content-encodingheaders but no bodycc434bcv14.4.8Compare Source
request.optionsinafterResponsehookdad6a91v14.4.7Compare Source
06029e0v14.4.6Compare Source
7a92064v14.4.5Compare Source
c079b93v14.4.4Compare Source
AbortSignal#timeout()(#2388)92b378ev14.4.3Compare Source
f2f8cb2v14.4.2Compare Source
f44ef43v14.4.1Compare Source
dfc54d9v14.4.0Compare Source
15ca4a0v14.3.0Compare Source
dbab6c3v14.2.1Compare Source
c81a611v14.2.0Compare Source
causeproperty with the original error toRequestError(#2327)4cbd01dv14.1.0Compare Source
RequestErrorresponse (#2325)5e4f6ffv14.0.0Compare Source
Breaking
a004263Improvements
followRedirectoption accept a function (#2306)7c3f147v13.0.0Compare Source
As a reminder, Got continues to require ESM. For TypeScript users, this includes having
"module": "node16", "moduleResolution": "node16"in your tsconfig.Breaking
52a1063enableUnixSocketsoption to befalseby default852c312Improvements
undefinedfor options (#2258)1cefe8bv12.6.1Compare Source
get-streamimport statement (#2266)67d5039v12.6.0Compare Source
88c88fb979272e0ca0b7fv12.5.3Compare Source
3cc40b5v12.5.2Compare Source
39f83b6v12.5.1Compare Source
3b3ea673e9d3afv12.5.0Compare Source
e049e948630815f0ac0b34c3762av12.4.1Compare Source
Fixes
options.contextbeing not extensibleb671480uploadProgressafter promise cancelation693de21v12.4.0Compare Source
Improvements
850773cFixes
beforeErrorhooks withHTTPErrorif thethrowHttpErrorsoption isfalse(#2104)3927348v12.3.1Compare Source
43b1467v12.3.0Compare Source
.off()method for events (#2092)88056bev12.2.0Compare Source
AbortController(#2020)6a6d2a9enableUnixSocketsoption (#2062)461b3d4v12.1.0Compare Source
Improvements
response.ok(#2043)22d58fb{throwHttpErrors: false}Fixes
861ccd9v12.0.4Compare Source
bb8eca9v12.0.3Compare Source
jsonoption (#2015)eb045bfv12.0.2Compare Source
encodingoption with{responseType: 'json'}(#1996)0703318v12.0.1Compare Source
nockcompatibility (#1959)bf39d2cRequestTypeScript type (#1940)0f9f2b8v12.0.0Compare Source
Introducing Got v12.0.0 🎉
Long time no see! The latest Got version (v11.8.2) was released just in February ❄️
We have been working hard on squashing bugs and improving overall experience.
If you find Got useful, you might want to sponsor the Got maintainers.
This package is now pure ESM
Please read this. Also see #1789.
[ERR_REQUIRE_ESM]andMust use import to load ES Moduleerrors. This is a problem with your setup, not Got.Required Node.js >=14
While working with streams, we encountered more Node.js bugs that needed workarounds.
In order to keep our code clean, we had to drop Node.js v12 as the code would get more messy.
We strongly recommend that you update Node.js to v14 LTS.
HTTP/2 support
Every Node.js release, the native
http2module gets more stable.Unfortunately there are still some issues on the Node.js side, so we decided to keep HTTP/2 disabled for now.
We may enable it by default in Got v13. It is still possible to turn it on via the
http2option.To run HTTP/2 requests, it is required to use Node.js v15.10 or above.
Bug fixes
Woah, we possibly couldn't make a release if we didn't fix some bugs!
49c16eecontent-lengthon ReadStream (#1510)472b8efff918fb1107cc6methodRewritingoption51d88a0urlnot being reused on retry in rare case (#1487)462bc63a59fac477df9c362305d706a2d3d1e1e506response.completewhen using cache9e15d88Cannot call enderror whenrequestreturns aWritable226cc393c23eea3c23eeagot.paginate does not call init hooks(#1574)3c23eeaConfiguration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.