Skip to content

Commit

Permalink
feat: export some fetch utilities (#1632)
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev committed Sep 3, 2022
1 parent 9ab4967 commit 84f56f7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index-fetch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const { getGlobalDispatcher } = require('./lib/global')
const fetchImpl = require('./lib/fetch')
const fetchImpl = require('./lib/fetch').fetch

module.exports.fetch = async function fetch (resource) {
const dispatcher = (arguments[1] && arguments[1].dispatcher) || getGlobalDispatcher()
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ if (nodeMajor > 16 || (nodeMajor === 16 && nodeMinor >= 8)) {
let fetchImpl = null
module.exports.fetch = async function fetch (resource) {
if (!fetchImpl) {
fetchImpl = require('./lib/fetch')
fetchImpl = require('./lib/fetch').fetch
}
const dispatcher = (arguments[1] && arguments[1].dispatcher) || getGlobalDispatcher()
try {
Expand Down
7 changes: 6 additions & 1 deletion lib/fetch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2039,4 +2039,9 @@ async function httpNetworkFetch (
}
}

module.exports = fetch
module.exports = {
fetch,
Fetch,
fetching,
finalizeAndReportTiming
}

0 comments on commit 84f56f7

Please sign in to comment.