Update got to the latest version 🚀 #1294
Closed
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.
☝️ Important announcement: Greenkeeper will be saying goodbye 👋 and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io
The devDependency got was updated from
10.7.0
to11.0.0
.This version is not covered by your current version range.
If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.
Publisher: sindresorhus
License: MIT
Release Notes for v11.0.0
Introducing Got 11! 🎉 The last major version was announced in December last year ❄️, by the time huge amount of bugs got fixed. Also, there are many improvements, for example HTTP2 support is finally live! 🌐
If you find Got useful, you might want to sponsor the Got maintainers.
Want to see how it's done under the hood? Feel free to review the Got Rewrite: v10.7.0...master
Breaking changes
Removed Electron support
Due to the inconsistencies beetwen the Electron's
net
module and the Node.jshttp
module, we have decided to officaly drop Electron support. Therefore, theuseElectronNet
option has been removed.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!
API
options.encoding
behavior has been reverted back to the one in Got 9.In other words, it's meant only for the Got promise.
To set the encoding for streams, simply call
stream.setEncoding(encoding)
.GotError
has been renamed toRequestError
for better readabilityand to comply with the documentation.
agent
option now accepts only an object withhttp
,https
andhttp2
properties.While the
http
andhttps
properties accept nativehttp(s).Agent
instances,the
http2
property must be an instance ofhttp2wrapper.Agent
or be undefined.dnsCache
option is now set to a default instance of CacheableLookup. It cannot be a Map-like instance anymore. The underlyingcacheable-lookup
package has received many improvements, for example it has been given ahosts
file support! Additionally, thecacheAdapter
option 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.init
hooks will be converted to instances ofRequestError
.RequestError
s provide much more useful information, for example you can access the Got options (througherror.options
), which is very useful when debugging.init
hook may not have aurl
property. To modify the request URL you should use abeforeRequest
hook instead.Note that this example shows a simple use case. In more complicated algorithms, you need to split the
init
hook into anotherinit
hook and abeforeRequest
hook.error.request
property is no longer aClientRequest
instance. Instead, it gives a Got stream, which provides a set of useful properties.Renamed types
Some of the types have been renamed to improve the readability:
ResponseObject
Response
Defaults
InstanceDefaults
DefaultOptions
Defaults
DefaultRetryOptions
RequiredRetryOptions
GotOptions
Options
GotRequestMethod
GotRequestFunction
Enhancements
HTTP2 support is here! Excited? Yay! Unfortunately it's off by default to make the migration more smooth. 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.
merge
function is slow (#1016)error.code
instead oferror.message
to compare errors (#981)as-promise.ts
(#932)init
hook tobeforeError
hook (#929)cacheable-lookup
(#1058)+
in query strings (#1113)got.stream(...)
(#1129)error.request
a Got stream (af0b147).Known bugs
timings
may indicate that the request was successful although it failed.downloadProgress
object may show incorrect data.Bug fixes
beforeRequest
hooks aren't called on redirects (#994)stream.pipeline(got.stream(...), ...)
(#1026)cache
along with thebody
option (#1021)got.mergeOptions(...)
doesn't mergeURLSearchParams
instances (#1011)authorization
header is leaking (#1090)resolveBodyOnly
option (#1140)beforeRetry
hooks are missingoptions.context
(#1141)promise.json()
doesn't throwParseError
(#1069)tough-cookie@4.0.0
(#1131)cache
option in a Got instance (#1098)cache
(#1128)Commits
The new version differs by 33 commits.
1f6ac45
11.0.0
202e1b4
Minor tweaks
b864dd2
Fix a readme typo (#1161)
6f621fd
Remove moot comments
af0b147
Add a
request
property to errorsc56c33a
Fix linting
03f9db7
Fix linting
2abacff
Fix replacing the HTTP cache
99d70df
Fix shortcut methods giving wrong result
e97cf7e
Fix the async iterator
9eb8407
Follow-up commit
407d597
Make sure it's compatible with tough-cookie@4.0.0
bddf707
Fix a typo in a comment
4fd1006
Fix shortcuts not throwing ParseErrors
5d69522
Fix the retry logic
There are 33 commits in total.
See the full diff
FAQ and help
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper bot 🌴