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

Replace deprecated request module with Node's built-in fetch function #150

Merged
merged 3 commits into from
Nov 17, 2023

Conversation

danielrozenberg
Copy link
Member

This uses node-fetch so that we can mock it in tests (nock can't mock the built-in fetch object, see nock/nock#2397), but node-fetch is a thin wrapper around the built-in fetch when it's available, so this is basically like using the built-in one :)

Breakdown of changes:

  • Replace request with node-fetch
  • Restore the tests that were disabled in Convert to ES Modules #144, use nock to mock network requests instead of stubbing the function
  • Convert lots of tests to async functions

@danielrozenberg danielrozenberg merged commit 5dbf8e5 into ampproject:main Nov 17, 2023
1 check passed
@danielrozenberg danielrozenberg deleted the fetch branch November 17, 2023 16:19
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