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

Use fetch-h2 by default with option to fallback to node-fetch #522

Merged
merged 5 commits into from
May 26, 2021

Conversation

andreban
Copy link
Member

@andreban andreban commented May 7, 2021

Copy link
Collaborator

@PEConn PEConn left a comment

Choose a reason for hiding this comment

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

Great, thanks!

@andreban
Copy link
Member Author

I'm thinking about using node-fetch by default but having a flag that optionally enables fetch-h2. @PEConn WDYT?

@PEConn
Copy link
Collaborator

PEConn commented May 13, 2021

What's the advantage of supporting both node-fetch and fetch-h2? Is it just incase fetch-h2 has some bugs?

@andreban
Copy link
Member Author

Yes. node-fetch has 21 million downloads / week and fetch-h2 around 6k.

@PEConn
Copy link
Collaborator

PEConn commented May 13, 2021

In that case, I suggest we use fetch-h2 by default and allow an option to use node-fetch. That way we'll know if there are any bugs, and if there aren't we can remove node-fetch.

- `node-fetch` doesn't support HTTP/2 and has had an issue for
  support open since 2017: node-fetch/node-fetch#342
- `fetch-h2` supports HTTP1.1 and HTTP/2 with upgrade.
andreban added 3 commits May 25, 2021 13:04
- Defaults to using `fetch-h2`.
- Allows optionally using `node-fetch`.
- Centralises calls to `fetch` in `FetchUtils`.
@andreban andreban changed the title Replaces node-fetch with fetch-h2 on core Use fetch-h2 by default with option to fallback to node-fetch May 25, 2021
@andreban andreban marked this pull request as ready for review May 25, 2021 12:15
Copy link
Collaborator

@PEConn PEConn left a comment

Choose a reason for hiding this comment

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

This is looking good!

Aren't we going to make one of them an optional dependency?

@andreban
Copy link
Member Author

Aren't we going to make one of them an optional dependency?

I don't think there's a big overhead in having both and this allow deciding which one to use when executing the app. Otherwise, users need to decide at install time.

@andreban andreban added the enhancement New feature or request label May 25, 2021
@PEConn
Copy link
Collaborator

PEConn commented May 26, 2021

Gotcha, LGTM

@andreban andreban merged commit cbab770 into GoogleChromeLabs:main May 26, 2021
@nohe427 nohe427 mentioned this pull request Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants