Skip to content
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
renovate-bot:renovate/got-10.x
Dec 3, 2019
Merged

fix(deps): update dependency got to v10#1162
kjin merged 1 commit intogoogleapis:masterfrom
renovate-bot:renovate/got-10.x

Conversation

@renovate-bot
Copy link
Copy Markdown
Contributor

@renovate-bot renovate-bot commented Dec 1, 2019

This PR contains the following updates:

Package Type Update Change
got dependencies major ^8.0.0 -> ^10.0.0
got dependencies major ^9.3.2 -> ^10.0.0

Release Notes

sindresorhus/got

v10.0.1

Compare Source

  • Fix using the json option with got.stream.post 2ec5c4d

v10.0.0

Compare 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-agent and agentkeepalive are not compatible with Node.js 10 and hence not compatible with Got as Got takes advantage of some Node.js 10-only APIs.

Breaking
  • Require Node.js 10 633651f
    - Why: This is so that we can use stream.pipeline for more reliable stream handling. Node.js 8 will be out of LTS at the end of this month anyway.
  • Remove support for protocol-less URLs in the url argument 92bc808
    - Why: To reduce ambiguity. It was not clear from just reading the code what it would default to.
    - Migrate:
- got('sindresorhus.com');
+ got('https://sindresorhus.com');
  • Rename the query option to searchParams and make it stricter b223663 5376216 518f0f5
    - Why: To get closer to the window.fetch naming in the browser.
    - Migrate:
- got(…, {query: …});
+ got(…, {searchParams: …});
  • Replace the baseUrl option with prefixUrl (#​829) 0d534ed
    - Note: We also made it stricter to reduce ambiguity. The Got url argument 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:
- got('/foo', {baseUrl: 'https://x.com'});
+ got('foo', {prefixUrl: 'https://x.com'});
  • Change the json option 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 body option 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 the responseType option 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:
- got(url, {body: {x: true}, json: true});
+ got.post(url, {json: {x: true}}).json();
  • Use the responseType option instead of encoding to 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:
- got(…, {encoding: null});
+ got(…, {responseType: 'buffer'});
  • Don't infer POST automatically when specifying body (#​756) e367bdb
    - Why: We're trying to reduce the amount of magic behavior.
    - Migrate:
- got(…, {body: 'foo'});
+ got.post(…, {body: 'foo'});
  • The retries.retry option was split into retries.limit and retries.calculateDelay b15ce1d
    - Migrate:
 got(…, {
 	retry: {
-		retries: 2
+		limit: 2
 	}
 });
 got(…, {
 	retry: {
-		retries: iteration => iteration < 2
+		calculateDelay: ({attemptCount}) => attemptCount < 2
 	}
 });
 got(…, {
 	headers: {
-		'user-agent': null
+		'user-agent': undefined
 	}
 });
  • Rename the Promise API property .fromCache to .isFromCache (#​768) b5e443b
  • Rename the stream option to isStream 518f0f5
    - Why: To make it clearer that it's a boolean and that it doesn't expect a stream to be passed in.
    - Migrate:
- got(…, {stream: true});
+ got(…, {isStream: true});
  • Don't include the Got version in the default user-agent header (#​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-agent header anyway.
  • Remove got.create() 518f0f5
    - You can achieve the same thing with got.extend() now.
  • Remove got.mergeInstances() 518f0f5
    - Use gotInstance.extend(...gotInstances) instead.
  • Move top-level error properties into an .options and .response property (#​773) 6eaa81b
    - Migrate:
- error.gotOptions
+ error.options

- error.headers
+ error.response.headers

- error.statusCode
+ error.response.statusCode

- error.statusMessage
+ error.response.statusMessage

- error.body
+ error.response.body

- error.redirectUrls
+ error.response.redirectUrls

- error.host
+ error.options.host

- error.hostname
+ error.options.hostname

- error.method
+ error.options.method

- error.protocol
+ error.options.protocol

- error.url
+ error.options.url

- error.path
+ error.options.path
  • Custom instance creation was simplified (#​707) 8eaef94
    - Note: got.mergeInstances(...instances) is deprecated. Use instanceA.extend(instanceB) instead.
    - Migrate:
### Merging instances
- got.mergeInstances(instanceA, instanceB, instanceC, …);
+ instanceA.extend(instanceB, instanceC, …);
### Merging options
- instanceA.extend(optionsB).extend(optionsC).extend(…);
+ instanceA.extend(optionsB, optionsC, …);
### Merging instances and options
- got.mergeInstances(instanceA.extend(optionsB), instanceC);
+ instanceA.extend(optionsB, instanceC, …);
### Extending handlers
- got.mergeInstances(instanceA, got.create({handler: handlerB}));
+ instanceA.extend({handlers: [handlerB]});
Enhancements
Fixes
  • Fix parsing response when using afterResponse hook (#​775) e2054cd
  • Fix port not being reset on redirect (#​729) ada5861
  • Fix the retry functionality (#​787) 0501e00
  • Fix default retry option value when specifying a number (#​809) 9c04a7c
  • Correctly handle promise- and stream-specific errors in the beforeError hook 134c9b7
  • Don't throw on early lookups 4faf5c7
  • Fix Node.js 13 compatibility (#​915) b0dfc95
  • Fix memory leak when using cache feature (#​792) 518f0f5
  • Don't throw on 204 No Content when parsing response (#​925) 518f0f5
  • When redirect fails, don't retry from scratch (#​930) 518f0f5
  • Retrying inside afterResponse hook should trigger beforeRetry hook (#​918) 518f0f5
  • Fix a bug that sometimes caused the Node.js process to hang 518f0f5
  • Fix a bug where cookies weren't reset on redirect between two different sites 518f0f5
  • Make the progress events not be based on internal Node.js properties cd11a50
Docs
  • Clarify retry behavior 5e6782a
  • Clarify prefixUrl behavior (#​943) f008bc9
  • Document that retry option doesn't work with streams 9088866
  • Encourage using Stream.pipeline() when using the stream API 06afb27
  • Add instructions for global-agent (#​822) ca8c560
  • Mention the TimeoutError.timings property 8fa18f4
  • Mention how to abort the request using hooks 96ea75f
All commits

v9.6.0

Compare Source

v9.5.1

Compare Source

  • Fix memory leak when using socket timeout and keepalive agent (#​694) 203dadc
  • Fix strange timing data for HTTP requests d136e61
  • Correctly preserve original status code when returning cached responses d136e61

v9.5.0

Compare Source

v9.4.0

Compare Source

  • Add ability to specify which network error codes to retry on. 9f3a099
  • Add Got options onto responses and errors. 33b838f
  • Correctly clear socket timeout on error. c8e358f

v9.3.2

Compare Source

v9.3.1

Compare Source

  • Don't override headers defined in the url argument when it's an object. 191e00a
  • Don't set content-length header when upload body size is null. 311b184

v9.3.0

Compare Source

  • Add option to allow defaults to be mutable. b392f60
  • Add beforeRedirect, beforeRetry, and afterResponse hooks. 325409c
  • Retry on a few more errors. fbaaa2a
  • Include body property in HTTPError. fdc0fa6
  • Transform user set headers to lowercase. a07b2be
  • Support Electron renderer timings. 25f18be

v9.2.2

Compare Source

v9.2.1

Compare Source

  • Don't cache response when HTTP error was received. #​597 b8480f3
  • Fix merging default & custom handlers. 5f191b9

v9.2.0

Compare Source

v9.1.0

Compare Source

v9.0.0

Compare 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.

Got is a human-friendly and powerful HTTP request library for Node.js

Breaking changes

  • Requires Node.js 8.
    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.
  • The retry functionality was rewritten to improve its reliability and to support retrying on HTTP status codes. Previously, it only retried on some network failures. 98b5664
    The option was renamed from 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: () => { … } } }
  • Renamed the .canceled property to .isCanceled. 00fdeea
  • Dropped support for the body option being an Array when form: true. dfe5b1c
    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.
  • Got throws an error if .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

  • Fewer dependencies and smaller install size!
    - Got v9: install size
    - Got v8: install size
    - Request (latest): install size
  • The 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. da4f236
  • Added got.extend() which lets you easily create instances of Got with some options overridden. bc41a49
  • Added got.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. bc41a49
  • Added a beforeRequest hook. 107756f
  • Added request and response events to the Promise API. e86aad7
  • The content-length header is now also automatically set if the body option is set to a fs.createReadStream instance. 6e7a455
  • You can now remove the default user-agent header by passing in 'user-agent': null as a header. e473a26
  • The body option can now be any kind of object, not just a plain object. 7a49ce7

Bug fixes

  • Fixed a problem with the cache not working when using the query option. 07a91cc
  • Less unhandled errors (Hopefully none!). f621184
  • Headers are now correctly proxied when you pipe got.stream(). 83bc44c
  • Lots of more bug fixes.

Other

  • 100% code coverage! Doing this caught a couple of bugs, so definitely worth doing even if 100% doesn't mean bug-free.
  • The codebase was significantly refactored for better readability and maintainability. b54b680

Team

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.


  • If you want to rebase/retry this PR, check this box

Newsflash: Renovate has joined WhiteSource, and is now free for all use. Learn more or view updated terms and privacy policies.

@trusted-contributions-gcf trusted-contributions-gcf Bot added the kokoro:run Add this label to force Kokoro to re-run the tests. label Dec 1, 2019
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 1, 2019
@kokoro-team kokoro-team removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Dec 1, 2019
@bcoe bcoe added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 2, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 2, 2019
@kjin kjin merged commit 432404d into googleapis:master Dec 3, 2019
@renovate-bot renovate-bot deleted the renovate/got-10.x branch December 3, 2019 22:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants