Skip to content

Commit 84f56f7

Browse files
authored
feat: export some fetch utilities (nodejs#1632)
1 parent 9ab4967 commit 84f56f7

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

index-fetch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
const { getGlobalDispatcher } = require('./lib/global')
4-
const fetchImpl = require('./lib/fetch')
4+
const fetchImpl = require('./lib/fetch').fetch
55

66
module.exports.fetch = async function fetch (resource) {
77
const dispatcher = (arguments[1] && arguments[1].dispatcher) || getGlobalDispatcher()

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ if (nodeMajor > 16 || (nodeMajor === 16 && nodeMinor >= 8)) {
8989
let fetchImpl = null
9090
module.exports.fetch = async function fetch (resource) {
9191
if (!fetchImpl) {
92-
fetchImpl = require('./lib/fetch')
92+
fetchImpl = require('./lib/fetch').fetch
9393
}
9494
const dispatcher = (arguments[1] && arguments[1].dispatcher) || getGlobalDispatcher()
9595
try {

lib/fetch/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2039,4 +2039,9 @@ async function httpNetworkFetch (
20392039
}
20402040
}
20412041

2042-
module.exports = fetch
2042+
module.exports = {
2043+
fetch,
2044+
Fetch,
2045+
fetching,
2046+
finalizeAndReportTiming
2047+
}

0 commit comments

Comments
 (0)