MCPcopy Index your code
hub / github.com/nodejs/node / httpNetworkFetch

Function httpNetworkFetch

deps/undici/src/lib/web/fetch/index.js:1811–2410  ·  view source on GitHub ↗
(
  fetchParams,
  includeCredentials = false,
  forceNewConnection = false
)

Source from the content-addressed store, hash-verified

1809
1810// https://fetch.spec.whatwg.org/#http-network-fetch
1811async function httpNetworkFetch (
1812 fetchParams,
1813 includeCredentials = false,
1814 forceNewConnection = false
1815) {
1816 assert(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed)
1817
1818 fetchParams.controller.connection = {
1819 abort: null,
1820 destroyed: false,
1821 destroy (err, abort = true) {
1822 if (!this.destroyed) {
1823 this.destroyed = true
1824 if (abort) {
1825 this.abort?.(err ?? new DOMException('The operation was aborted.', 'AbortError'))
1826 }
1827 }
1828 }
1829 }
1830
1831 // 1. Let request be fetchParams’s request.
1832 const request = fetchParams.request
1833
1834 // 2. Let response be null.
1835 let response = null
1836
1837 // 3. Let timingInfo be fetchParams’s timing info.
1838 const timingInfo = fetchParams.timingInfo
1839
1840 // 4. Let httpCache be the result of determining the HTTP cache partition,
1841 // given request.
1842 // TODO: cache
1843 const httpCache = null
1844
1845 // 5. If httpCache is null, then set request’s cache mode to "no-store".
1846 if (httpCache == null) {
1847 request.cache = 'no-store'
1848 }
1849
1850 // 6. Let networkPartitionKey be the result of determining the network
1851 // partition key given request.
1852 // TODO
1853
1854 // 7. Let newConnection be "yes" if forceNewConnection is true; otherwise
1855 // "no".
1856 const newConnection = forceNewConnection ? 'yes' : 'no' // eslint-disable-line no-unused-vars
1857
1858 // 8. Switch on request’s mode:
1859 if (request.mode === 'websocket') {
1860 // Let connection be the result of obtaining a WebSocket connection,
1861 // given request’s current URL.
1862 // TODO
1863 } else {
1864 // Let connection be the result of obtaining a connection, given
1865 // networkPartitionKey, request’s current URL’s origin,
1866 // includeCredentials, and forceNewConnection.
1867 // TODO
1868 }

Callers 1

httpNetworkOrCacheFetchFunction · 0.70

Calls 15

queueMicrotaskFunction · 0.85
processEndOfBodyFunction · 0.85
processBodyErrorFunction · 0.85
isErroredFunction · 0.85
isCancelledFunction · 0.70
dispatchFunction · 0.70
makeResponseFunction · 0.70
makeNetworkErrorFunction · 0.70
isAbortedFunction · 0.70
readableStreamCloseFunction · 0.70
finalizeResponseFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…