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

fix: do not require node-fetch for Node 18+ #644

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/server.js
Expand Up @@ -6,11 +6,11 @@ try {
// Hence the try/catch
fetch = jest.requireActual('node-fetch'); //eslint-disable-line no-undef
} catch (e) {
fetch = require('node-fetch');
fetch = global.fetch || require('node-fetch');
}
const Request = fetch.Request;
const Response = fetch.Response;
const Headers = fetch.Headers;
const Request = global.Request || fetch.Request;
const Response = global.Response || fetch.Response;
const Headers = global.Headers || fetch.Headers;
const Stream = require('stream');
const FetchMock = require('./lib/index');
const http = require('http');
Expand Down