diff --git a/lib/internal/bootstrap/web/exposed-window-or-worker.js b/lib/internal/bootstrap/web/exposed-window-or-worker.js index 2459bee85bb8b0..d99ace09c5472b 100644 --- a/lib/internal/bootstrap/web/exposed-window-or-worker.js +++ b/lib/internal/bootstrap/web/exposed-window-or-worker.js @@ -57,32 +57,19 @@ defineReplaceableLazyAttribute(globalThis, 'perf_hooks', ['performance']); const { installObjectURLMethods } = require('internal/url'); installObjectURLMethods(); -{ - // https://fetch.spec.whatwg.org/#fetch-method - function set(value) { - ObjectDefineProperty(globalThis, 'fetch', { - __proto__: null, - writable: true, - value, - }); - } - ObjectDefineProperty(globalThis, 'fetch', { - __proto__: null, - configurable: true, - enumerable: true, - set, - get() { - function fetch(input, init = undefined) { - // Loading undici alone lead to promises which breaks lots of tests so we - // have to load it really lazily for now. - const { fetch: impl } = require('internal/deps/undici/undici'); - return impl(input, init); - } - set(fetch); - return fetch; - }, - }); -} +// https://fetch.spec.whatwg.org/#fetch-method +ObjectDefineProperty(globalThis, 'fetch', { + __proto__: null, + configurable: true, + enumerable: true, + writable: true, + value: function fetch(input, init = undefined) { // eslint-disable-line func-name-matching + // Loading undici alone lead to promises which breaks lots of tests so we + // have to load it really lazily for now. + const { fetch: impl } = require('internal/deps/undici/undici'); + return impl(input, init); + }, +}); // https://xhr.spec.whatwg.org/#interface-formdata // https://fetch.spec.whatwg.org/#headers-class