netlify-plugin-cypress
netlify-plugin-cypress copied to clipboard
fix(deps): update dependency got to v12
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| got | 10.7.0 -> 12.5.2 |
Release Notes
sindresorhus/got
v12.5.2
v12.5.1
- Fix compatibility with TypeScript and ESM
3b3ea67 - Fix request body not being properly cached (#2150)
3e9d3af
v12.5.0
- Disable method rewriting on 307 and 308 status codes (#2145)
e049e94 - Upgrade dependencies
8630815f0ac0b34c3762a
v12.4.1
Fixes
- Fix
options.contextbeing not extensibleb671480 - Don't emit
uploadProgressafter promise cancelation693de21
v12.4.0
Improvements
Fixes
v12.3.1
v12.3.0
v12.2.0
- Support
AbortController(#2020)6a6d2a9 - Add
enableUnixSocketsoption (#2062)461b3d4
v12.1.0
Improvements
- Add
response.ok(#2043)22d58fb- This is only useful if you have
{throwHttpErrors: false}
- This is only useful if you have
Fixes
v12.0.4
- Remove stream lock - unreliable since Node 17.3.0
bb8eca9
v12.0.3
v12.0.2
v12.0.1
- Fix
nockcompatibility (#1959)bf39d2c - Fix missing export of
RequestTypeScript type (#1940)0f9f2b8
v12.0.0
Introducing Got v12.0.0 :tada:
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 https://github.com/sindresorhus/got/issues/1789.
- Please don't open issues about
[ERR_REQUIRE_ESM]andMust use import to load ES Moduleerrors. This is a problem with your setup, not Got. - Please don't open issues about using Got with Jest. Jest does not fully support ESM.
- Pretty much any problem with loading this package is a problem with your bundler, test framework, etc, not Got.
- If you use TypeScript, you will want to stay on Got v11 until TypeScript 4.6 is out. Why.
- If you use a bundler, make sure it supports ESM and that you have correctly configured it for ESM.
- The Got issue tracker is not a support channel for your favorite build/bundler tool.
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 http2 module 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 http2 option.
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!
- Do not throw on custom stack traces (#1491)
49c16ee - Remove automatic
content-lengthon ReadStream (#1510)472b8ef - Fix promise shortcuts in case of error status code (#1543)
ff918fb1107cc6 - Invert the
methodRewritingoption51d88a0 - Fix
urlnot being reused on retry in rare case (#1487)462bc63 - Fix hanging promise on HTTP/2 timeout (#1492)
a59fac4 - Prevent uncaught ParseErrors on initial successful response (#1527)
77df9c3 - Throw an error when retrying with consumed body (#1507)
62305d7 - Fix a Node.js 16 bug that hangs Got streams
06a2d3d - Fix default pagination handling for empty Link header (#1768)
1e1e506 - Fix incorrect
response.completewhen using cache9e15d88 - Fix
Cannot call enderror whenrequestreturns aWritable226cc39 - Fix Request options not being reused on retry
3c23eea - Fix types being not compatible with CommonJS
3c23eea - Fix
got.paginate does not call init hooks(#1574)3c23eea - Generate a new object when passing options to the native
httpsmodule (#1567)3c23eea - Remove stream reuse check (#1803)
9ecc5ee - Fix merging
searchParams(#1814)1018c20732e9bd - Fix unhandled exception when lookup returns invalid IP early (#1737)
2453e5e - Fix relative URLs when paginating
439fb82 - Require url to be an instance of URL when paginating (#1818)
eda69ff - Fix
usernameandpasswordencoding in URL (#1169 #1317)d65d0ca - Clone raw options
1c4cefc - Fix invalid
afterResponsereturn checkcbc8902 - Fix
https.alpnProtocolsnot having an effecte1099fb
Improvements
- Make the
contextoption mergeable (#1459)2b8ed1f - Add generic argument to AfterResponseHook TypeScript type (#1589)
6fc04a9 - Add read timeout (#1518)
e943672(blocked by https://github.com/nodejs/node/issues/35923) - Improve the pagination API (#1644)
2675046 - Change the stackAllItems option to be false by default (#1645)
1120370 - Throw when afterResponse hook returns an invalid value
4f21eb3 - Add
retry.backoffLimitoption41c4136 - Add
noiseretry optione830077 - Enable more HTTPS options
83575d5fe723a0(thanks @Giotino) - Define
error.codef27e8d3 - Set
options.urleven if some options are invalid8d6a680 - Improve memory usage when merging options
2db5ec5 - Support async generators as body
854430f3df52f3 - Add missing
oncetypes for Stream API3c23eea - New error type:
RetryErrorwhich always triggers a new retry when thrown3c23eea error.optionsis now enumerable3c23eeadefaults.handlersdon't need a default handler now3c23eea- Add a parser for the
Linkheader3c23eea - General code improvements
a5dd9aa
Breaking changes
Improved option normalization
- Got exports an
Optionclass that is specifically designed to parse and validate Got options. It is made of setters and getters that provide fast normalization and more consistent behavior.
When passing an option does not exist, Got will throw an error. In order to retrieve the options before the error, use error.options.
import got from 'got';
try {
await got('https://httpbin.org/anything', {
thisOptionDoesNotExist: true
});
} catch (error) {
console.error(error);
console.error(error.options.url.href);
// Unexpected option: thisOptionDoesNotExist
// https://httpbin.org/anything
}
- The
inithook now accepts a second argument:self, which points to anOptionsinstance.
In order to define your own options, you have to move them to options.context in an init hook or store them in options.context directly.
- The
inithooks are ran only when passing an options object explicitly.
- await got('https://example.com'); // this will *not* trigger the init hooks
+ await got('https://example.com', {}); // this *will** trigger init hooks
options.merge()replacedgot.mergeOptionsandRequest.normalizeArguments
- got.defaults.options = got.mergeOptions(got.defaults.options, {…});
+ got.defaults.options.merge(…);
This fixes issues like #1450
- Legacy
Urlinstances are not supported anymore. You need to use WHATWG URL instead.
- await got(string, {port: 8443});
+ const url = new URL(string);
+ url.port = 8443;
+ await got(url);
- No implicit timeout declaration.
- await got('https://example.com', {timeout: 5000})
+ await got('https://example.com', {timeout: {request: 5000})
- No implicit retry declaration.
- await got('https://example.com', {retry: 5})
+ await got('https://example.com', {retry: {limit: 5})
dnsLookupIpVersionis now a number (4 or 6) or undefined
- await got('https://example.com', {dnsLookupIpVersion: 'ipv4'})
+ await got('https://example.com', {dnsLookupIpVersion: 4})
redirectUrlsandrequestUrlnow give URL instances
- request.requestUrl
+ request.requestUrl.origin
+ request.requestUrl.href
+ request.requestUrl.toString()
- request.redirectUrls[0]
+ request.redirectUrls[0].origin
+ request.redirectUrls[0].href
+ request.redirectUrls[0].toString()
- Renamed
request.abortedtorequest.isAborted
- request.aborted
+ request.isAborted
Reason: consistency with options.isStream.
- Renamed the
lookupoption todnsLookup
- await got('https://example.com', {lookup: cacheable.lookup})
+ await got('https://example.com', {dnsLookup: cacheable.lookup})
- The
beforeRetryhook now accepts only two arguments:errorandretryCount
await got('https://example.com', {
hooks: {
beforeRetry: [
- (options, error, retryCount) => {
- console.log(options, error, retryCount);
- }
+ (error, retryCount) => {
+ console.log(error.options, error, retryCount);
+ }
]
}
})
The options argument has been removed, however it's still accessible via error.options. All modifications on error.options will be reflected in the next requests (no behavior change, same as with Got 11).
- The
beforeRedirecthook's first argument (options) is now a cloned instance of the Request options.
This was done to make retrieving the original options possible: plainResponse.request.options.
await got('http://szmarczak.com', {
hooks: {
beforeRedirect: [
(options, response) => {
- console.log(options === response.request.options); //=> true [invalid! our original options were overriden]
+ console.log(options === response.request.options); //=> false [we can access the original options now]
}
]
}
})
- The
redirectevent now takes two arguments in this order:updatedOptionsandplainResponse.
- stream.on('redirect', (response, options) => …)
+ stream.on('redirect', (options, response) => …)
Reason: consistency with the beforeRedirect hook.
- The
socketPathoption has been removed. Use theunix:protocol instead.
- got('/containers/json', {socketPath: '/var/run/docker.sock'})
+ got('unix:/var/run/docker.sock:/containers/json')
+ got('http://unix:/var/run/docker.sock:/containers/json')
- The
retryWithMergedOptionsfunction in anafterResponsehook no longer returns aPromise.
It now throws RetryError, so this should this should be the last function being executed.
This was done to allow beforeRetry hooks getting called.
- You can no longer set
options.agenttofalse. To do so, you need to define all theoptions.agentproperties:http,httpsandhttp2.
await got('https://example.com', {
- agent: false
+ agent: {
+ http: false,
+ https: false,
+ http2: false
+ }
})
- When passing a
urloption when paginating, it now needs to be an absolute URL - theprefixUrloption is always reset from now on. The same when retrying in anafterResponsehook.
- return {url: '/location'};
+ return {url: new URL('/location', response.request.options.url)};
There was confusion around the prefixUrl option. It was counterintuitive if used with the Pagination API. For example, it worked fine if the server replied with a relative URL, but if it was an absolute URL then the prefixUrl would end up duplicated. In order to fix this, Got now requires an absolute URL - no prefixUrl will be applied.
got.extend(…)will throw when passing some options that don't accept undefined - undefined no longer retains the old value, as setting undefined explicitly may reset the option
Documentation
We have redesigned the documentation so it's easier to navigate and find exactly what you are looking for. We hope you like it :heart:
v11.8.5
- Backport security fix https://github.com/sindresorhus/got/commit/861ccd9ac2237df762a9e2beed7edd88c60782dc
v11.8.3
- Bump cacheable-request dependency (#1921)
9463bb6 - Fix
HTTPErrormissing.codeproperty (#1739)0e167b8
v11.8.2
- Make the
dnsCacheoption lazy (#1529)3bd245fThis slightly improves Got startup performance and fixes an issue with Jest.
v11.8.1
v11.8.0
- Fix for sending files with size
0onstat(#1488)7acd380 beforeRetryallows stream body if different from original (#1501)3dd2273- Set default value for an options object (#1495)
390b145
v11.7.0
Improvements
- Add
pfxHTTPS option (#1364)c33df7f - Update
bodyafterbeforeRequest(#1453)e1c1844 - Don't allocate buffer twice (#1403)
7bc69d9
Fixes
- Fix a regression where body was sent after redirect
88b32ea - Fix destructure error on
promise.json()c97ce7c - Do not ignore userinfo on a redirect to the same origin
52de13b
v11.6.2
Bug fixes
- Inherit the
prefixUrloption from parent if it'sundefined(#1448)a3da70a - Prepare a fix for hanging promise on Node.js 14.10.x
29d4e32 - Prepare for Node.js 15.0.0
c126ff1
Docs
- Point travis-ci.org badge to travis-ci.com (#1442)
2b352d3 - Clarify the retry mechanism
f248618 - Fix
RequestErrorlinks3ed4af6
Tests
v11.6.1
Fixes
Meta
v11.6.0
Improvements
- Add
retrystream event (#1384)7072198 - Add types for
http-cache-semanticsoptions2e2295f - Make
CancelErrorinheritRequestError1f132e8 - Add
retryAftertoRetryObject643a305 - Add documentation comments to exported TypeScript types (#1278)
eaf1e02 - Move cache options into a
cacheOptionsproperty9c16d90
Bug fixes
- Got promise shouldn't retry when the body is a stream
6e1aeae
Docs
- Add an example of nock integration with retrying
f7bbc37 - Fix
CancelErrordocs28c400f - Fix retry delay function in the
README(#1425)38bbb04
v11.5.2
Docs
- Add hpagent to proxy section (#1363)
a3e171c - Mention header lowercasing in
requestmigration guide (#1387)a748343 - Fixed deprecationWarning on https options (#1391)
9a309bd
Bug fixes
v11.5.1
Enhancements
- Upgrade
http2-wrapperto1.0.0-beta.5.016e7f03 - Compatibility fix to ignore incorrect Node.js 12 typings
f7a137961d6f61
Bug fixes
Docs
- Mention HTTP/2 proxying in
readme.md4ebd26a - Update the comparison table
bd2d532c833939 - Document the hierarchy of error classes (#1359)
559526e - Fix example code for HTTPS proxy (#1360)
4083347
v11.5.0
Improvements
- Add
backoffoption to pagination (#1182)4be7446 - Upgrade dependencies (#1345)
b9a855d476c0268d697bc - Upgrade to TypeScript 3.9 (#1267)
b51d836
Fixes
- Fix TypeScript types for Promise API (#1344)
676be6d - Fix cache not working with HTTP2
ac5f67d - Fix
responseevent not being emitted on cache verify request (#1305)da4769e - Work around a bug in Node.js <=12.18.2
f33e8bc - Remove request error handler after response is downloaded
e1afe82 - Revert "Remove request error handler after response is downloaded"
aeb2e07
Docs
- Mention advanced usage of a
beforeRequesthook779062a - Mention to end the stream if there's no body
044767e
v11.4.0
- Fix hanging promise on timeout on HTTP error
934211f - Use async iterators to get response body (#1256)
7dcd145 - Fix promise not returning Buffer on compressed response
5028c11 - Clarify options.encoding docs
04f3ea4 - Fix unhandled
The server aborted pending requestrejection728aef9 - Add missing
ECONNRESETcode to an abort errord325d35 - Fix
prefixUrlnot working when theurlargument is empty8d3412a - Improve the
searchParamsoption4dbada9 - Fix non-enumerable options [such as body] not being used
8f775c7
v11.3.0
- Deep merge
httpsoptions (#1304)c98f0d7 - Add options to customize parsing/stringifying JSON (#1298)
cb4da8d - Add
dnsLookupIpVersionoption (#1264)7f643bb
v11.2.0
- Provide an overload for unknown
responseType(#1276)b9ba18a - Fix overriding some options in a
beforeRequesthook (#1293)d8c00cf - Fix hanging promise on aborted requests on Node v14.3.0 (#1296)
2ccc4c2 - Do not wait for
readyevent if the file descriptor is already opened (#1289)2c8fe19 - General improvements to HTTPS API (#1255)
697de37
v11.1.4
- Clarify docs for got.HTTPError (#1244)
3f125f1 - Upgrade
cacheable-lookupto 5.0.39770e54 - Add a Runkit example (#1253)
48bbb36 - Mention
options.rejectUnauthorizedin the documentation9b04963 - Test
responseTypeset toundefined0e8582f - Slightly improve RunKit example
6f84051 - Make
got.paginate()an alias forgot.paginate.each()5480b31 - Don't force query string normalization (#1246)
761b8e0 - Upgrade
decompress-responseto6.0.0c2bc014 - Migrate from
lolexto@sinonjs/fake-timers(#1270)df333dd - Make
calculateDelaypromisable (#1266)3745efc
v11.1.3
- Do not use deprecated
request.abort()(#1242)ab338a7 - Remove the
hostheader on redirect (#1241)8ff71d9 - Prevent URL pollution (#1243)
7dbb9ee - Fix duplicated searchParams for pagination API (#1229)
91aa0ac - Add a test for stringified
searchParamsin merge (#1208)7d7361c - Fix reusing options when paginating
8862270 - Fix an invalid pagination test
47c1afe5131dc2
v11.1.2
Bug fixes
- Disable
options.dnsCacheby default79507c2
This should stay disabled when making requests to internal hostnames such as localhost, database.local etc. CacheableLookup uses dns.resolver4(..) and dns.resolver6(...) under the hood and fall backs to dns.lookup(...) when the first two fail, which may lead to additional delay.
Enhancements
v11.1.1
- Improve Node.js 14 compatibility
50ef99a - Fix
got.mergeOptions()regression157e02b - Fix hanging promise when using cache
7b19e8f - Make
options.responseTypeoptional when using a template9ed0a39
v11.1.0
- Add
pagination.stackAllItemsoption (#1214)c1208d1 - Allow response body to be typed for pagination API (#1212)
c127f5b - Fix some options not working with the pagination API
278c421
v11.0.3
Fixes
- Limit number of requests in pagination to prevent accidental overflows (#1181)
4344c3a - Fix promise rejecting before retry
b927e2d - Fix
options.searchParamsduplicates429db40 - Prevent calling
.abort()on a destroyed request63c1b72
Docs
- Fix incorrect usage in the readme examples (#1203)
16ff82f - Note that
cacheanddnsCachecan befalse7c5290d
v11.0.2
- Fix
response.statusMessagebeing null965bd03 - Update the
http2-wrapperdependency to1.0.0-beta.4.44e8de8e - Use
Mergeas it's stricter than the intersection operatord3b972e - Prevent silent rejections in rare cases
8501c69 - Do not alter
options.body835c70b
v11.0.1
Fixed two regressions:
Improved TypeScript types for errors inherited from RequestError
v11.0.0
Introducing Got 11! :tada: The last major version was in December last year. :snowflake: Since then, a huge amount of bugs has been fixed. There are also many new features, for example, HTTP2 support is finally live! :globe_with_meridians:
If you find Got useful, you might want to sponsor the Got maintainers.
Breaking changes
Removed support for electron.net
Due to the inconsistencies between the Electron's net module and the Node.js http module, we have decided to officially drop support for it. Therefore, the useElectronNet option has been removed.
You'll still be able to use Got in the Electron main process and in the renderer process through the electron.remote module or if you use Node.js shims.
The Pagination API is now stable
We haven't seen any bugs yet, so please give it a try! If you want to leave some feedback, you can do it here. Any suggestion is greatly appreciated!
{
- _pagination: {...}
+ pagination: {...}
}
API
- The
options.encodingbehavior has been reverted back to the Got 9 behavior. In other words, the options is only meant for the Got promise API. To set the encoding for streams, simply callstream.setEncoding(encoding).
-got.stream('https://sindresorhus.com', {encoding: 'base64'});
+got.stream('https://sindresorhus.com').setEncoding('base64');
// Promises stay untouched
await got('https://sindresorhus.com', {encoding: 'base64'});
- The error name
GotErrorhas been renamed toRequestErrorfor better readability and to comply with the documentation.
-const {GotError} = require('got');
+const {RequestError} = require('got');
- The
agentoption now accepts only an object withhttp,httpsandhttp2properties. While thehttpandhttpsproperties accept nativehttp(s).Agentinstances, thehttp2property must be an instance ofhttp2wrapper.Agentor be undefined.
{
- agent: new https.Agent({keepAlive: true})
}
{
+ agent: {
+ http: new http.Agent({keepAlive: true}),
+ https: new https.Agent({keepAlive: true}),
+ http2: new http2wrapper.Agent()
+ }
}
- The
dnsCacheoption is now set to a default instance ofCacheableLookup. It cannot be aMap-like instance anymore. The underlyingcacheable-lookuppackage has received many improvements, for example, it has receivedhostsfile support! Additionally, thecacheAdapteroption has been renamed tocache. Note that it's no longer passed to Keyv, so you need to pass a Keyv instance it if you want to save the data for later.
{
- dnsCache: new CacheableLookup({
- cacheAdapter: new Map()
- })
}
{
+ dnsCache: new CacheableLookup({
+ cache: new Keyv({
+ cacheAdapter: new Map()
+ })
+ })
}
// Default:
{
dnsCache: new CacheableLookup()
}
- Errors thrown in
inithooks will be converted to instances ofRequestError.RequestErrors provide much more useful information, for example, you can access the Got options (througherror.options), which is very useful when debugging.
const got = require('got');
(async () => {
try {
await got('https://sindresorhus.com', {
hooks: {
init: [
options => {
if (!options.context) {
throw new Error('You need to pass a `context` option');
}
}
]
}
});
} catch (error) {
console.log(`Request failed: ${error.message}`);
console.log('Here are the options:', error.options);
}
})();
- The options passed in an
inithook may not have aurlproperty. To modify the request URL you should use abeforeRequesthook instead.
{
hooks: {
- init: [
+ beforeRequest: [
options => {
options.url = 'https://sindresorhus.com';
}
]
}
}
Note that this example shows a simple use case. In more complicated algorithms, you need to split the init hook into another init hook and a beforeRequest hook.
- The
error.requestproperty is no longer aClientRequestinstance. Instead, it gives a Got stream, which provides a set of useful properties.
const got = require('got');
(async () => {
try {
await got('https://sindresorhus.com/notfound');
} catch (error) {
console.log(`Request failed: ${error.message}`);
console.log('Download progress:', error.request.downloadProgress);
}
})();
Renamed TypeScript types
Some of the TypeScript types have been renamed to improve the readability:
| Old type | New type |
ResponseObject |
Response |
Defaults |
InstanceDefaults |
DefaultOptions |
Defaults |
DefaultRetryOptions |
RequiredRetryOptions |
GotOptions |
Options |
GotRequestMethod |
GotRequestFunction |
Other
- Now requires Node.js 10.19 or later.
Enhancements
HTTP2 support is here! Excited? Yay! Unfortunately, it's off by default to make the migration smoother. Many Got users have set up their own Agents and we didn't want to break them. But fear no more, it will come enabled by default in Got 12.
const got = require('got');
(async () => {
const response = await got('https://nghttp2.org/httpbin/anything', {http2: true});
console.log(response.socket.alpnProtocol);
//=> 'h2'
})();
- The
mergefunction is slow (#1016) - Use
error.codeinstead oferror.messageto compare errors (#981) - Pass error thrown in the
inithook tobeforeErrorhook (#929) - Errors have undefined body when using streams (#1138)
- Spaces should be normalized as
+in query strings (#1113) - Modify response headers while using
got.stream(...)(#1129) - Make
error.requesta Got stream (af0b147).
Known bugs
- When some errors occur, the
timingsmay indicate that the request was successful although it failed. - When some errors occur, the
downloadProgressobject may show incorrect data.
Bug fixes
- Requests to UNIX sockets are missing query strings (#1036)
beforeRequesthooks aren't called on redirects (#994)- Errors are swallowed when using
stream.pipeline(got.stream(...), ...)(#1026) - Cannot use the
cachealong with thebodyoption (#1021) - Got doesn't throw on leading slashes (#1057)
- Got throws when passing already frozen options (#1050)
- Cannot type Got options properly due to missing types (#954)
got.mergeOptions(...)doesn't mergeURLSearchParamsinstances (#1011)- The
authorizationheader is leaking (#1090) - Pagination should ignore the
resolveBodyOnlyoption (#1140) - Cannot reuse user-provided options (#1118)
- Broken with Node.js ≥ 13.10.0 (#1107)
- Cache is not decompressed (#1158)
beforeRetryhooks are missingoptions.context(#1141)promise.json()doesn't throwParseError(#1069)- Not compatible with
[email protected](#1131) - Shortcuts give body from the failed request on token renewal (#1120)
- No effect when replacing the
cacheoption in a Got instance (#1098) - Memory leak when using
cache(#1128) - Got doesn't throw on aborted requests by the server (#1096)
All changes
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 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.
- [ ] If you want to rebase/retry this PR, click this checkbox.
This PR has been generated by Mend Renovate. View repository job log here.