Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency got to v9 #10861

Merged
merged 4 commits into from
Jul 4, 2019
Merged

Update dependency got to v9 #10861

merged 4 commits into from
Jul 4, 2019

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jul 2, 2019

This PR contains the following updates:

Package Type Update Change
got dependencies major 8.3.2 -> 9.6.0

Release Notes

sindresorhus/got

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: "before 3am on Tuesday" (UTC).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻️ Rebasing: Whenever PR becomes conflicted, or if you modify the PR title to begin with "rebase!".

🔕 Ignore: Close this PR and you won't be reminded about this update again.


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

This PR has been generated by Renovate Bot. View repository job log here.

@renovate renovate bot force-pushed the renovate/got-9.x branch 3 times, most recently from 1e6edd5 to 75f0308 Compare July 2, 2019 11:16
@naz naz self-assigned this Jul 2, 2019
@naz
Copy link
Contributor

naz commented Jul 2, 2019

@kevinansfield the change in retry logic has some implications on the amount of external request Ghost does. It will now increase when 500 is returned due to 2 additional retries (described in commits above).

Don't necessarily see any bad implications out of it but wanted to get a second opinion on this. If we want to avoid this behavior, there's an option to override the retries with status codes used in got v8.x

@@ -133,7 +133,8 @@ describe('Request', function () {

const requestMock = nock('http://nofilehere.com')
.get('/files/test.txt')
.reply(500, {message: 'something aweful happend', code: 'AWFUL_ERROR'});
.times(3) // 1 original request + 2 default retries
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gargol Was trying to understand from changelog/commit, is the times here with the value representing default, which is it will 3 times before returning 500? If so, is it possible to override it to use 1 instead of 3 before returning the status code? Also, any reason we skipped sending the message along with status code below, as in old code?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is configuring nock (mocking external server that is pinged by got), so it had to adjust to the changes to the new default behavior of got (now it makes 2 additional retries when 500, and bunch others, is returned). If we just return 500 after 1st request, got will not be able to reach anything on the retry.

Think the question is more if we should allow making 2 additional requests for your wrapper of got.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, got it. Yeah i don't see any bad implication either, and seems to be a sane default. Either ways, we should still be adding the message along with status code here in tests like previously, unless i am missing something.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rishabhgrg have added the response body back to the test and also a check in the test itself. Merging it 🚢

@rishabhgrg
Copy link
Contributor

rishabhgrg commented Jul 4, 2019

@gargol I had clicked the checkbox to rebase after merging other renvoate PRs, but that apparently removed your commit with the fix, sorry! 😓 That's whats causing the tests to fail again as well, do you still have the commit locally?

renovate-bot and others added 3 commits July 4, 2019 09:38
- The underlying issue is change in retry behavior in 'got' (sindresorhus/got@a3e77de)
- Now 500 responses trigger 2 default retries
@renovate
Copy link
Contributor Author

renovate bot commented Jul 4, 2019

PR has been edited

👷 This PR has received other commits, so Renovate will stop updating it to avoid conflicts or other problems. If you wish to abandon your changes and have Renovate start over you may click the "rebase" checkbox in the PR body/description.

- Also added check for it
@naz naz merged commit 1f32a13 into master Jul 4, 2019
@renovate renovate bot deleted the renovate/got-9.x branch July 4, 2019 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants