MCPcopy Create free account
hub / github.com/nodejs/node / makeRequest

Function makeRequest

deps/undici/src/lib/web/fetch/request.js:912–958  ·  view source on GitHub ↗
(init)

Source from the content-addressed store, hash-verified

910
911// https://fetch.spec.whatwg.org/#requests
912function makeRequest (init) {
913 return {
914 method: init.method ?? 'GET',
915 localURLsOnly: init.localURLsOnly ?? false,
916 unsafeRequest: init.unsafeRequest ?? false,
917 body: init.body ?? null,
918 client: init.client ?? null,
919 reservedClient: init.reservedClient ?? null,
920 replacesClientId: init.replacesClientId ?? '',
921 window: init.window ?? 'client',
922 keepalive: init.keepalive ?? false,
923 serviceWorkers: init.serviceWorkers ?? 'all',
924 initiator: init.initiator ?? '',
925 destination: init.destination ?? '',
926 priority: init.priority ?? null,
927 origin: init.origin ?? 'client',
928 policyContainer: init.policyContainer ?? 'client',
929 referrer: init.referrer ?? 'client',
930 referrerPolicy: init.referrerPolicy ?? '',
931 mode: init.mode ?? 'no-cors',
932 useCORSPreflightFlag: init.useCORSPreflightFlag ?? false,
933 // TODO: is this credentials mode? https://fetch.spec.whatwg.org/#concept-request-credentials-mode
934 credentials: init.credentials ?? 'same-origin',
935 useCredentials: init.useCredentials ?? false,
936 cache: init.cache ?? 'default',
937 redirect: init.redirect ?? 'follow',
938 integrity: init.integrity ?? '',
939 cryptoGraphicsNonceMetadata: init.cryptoGraphicsNonceMetadata ?? '',
940 parserMetadata: init.parserMetadata ?? '',
941 reloadNavigation: init.reloadNavigation ?? false,
942 historyNavigation: init.historyNavigation ?? false,
943 userActivation: init.userActivation ?? false,
944 taintedOrigin: init.taintedOrigin ?? false,
945 redirectCount: init.redirectCount ?? 0,
946 responseTainting: init.responseTainting ?? 'basic',
947 preventNoCacheCacheControlHeaderModification: init.preventNoCacheCacheControlHeaderModification ?? false,
948 done: init.done ?? false,
949 timingAllowFailed: init.timingAllowFailed ?? false,
950 useURLCredentials: init.useURLCredentials ?? undefined,
951 traversableForUserPrompts: init.traversableForUserPrompts ?? 'client',
952 urlList: init.urlList,
953 url: init.urlList[0],
954 headersList: init.headersList
955 ? new HeadersList(init.headersList)
956 : new HeadersList()
957 }
958}
959
960// https://fetch.spec.whatwg.org/#concept-request-clone
961function cloneRequest (request) {

Callers 4

constructorMethod · 0.70
cloneRequestFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected