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

Method addAll

deps/undici/src/lib/web/cache/cache.js:89–257  ·  view source on GitHub ↗
(requests)

Source from the content-addressed store, hash-verified

87 }
88
89 async addAll (requests) {
90 webidl.brandCheck(this, Cache)
91
92 const prefix = 'Cache.addAll'
93 webidl.argumentLengthCheck(arguments, 1, prefix)
94
95 // 1.
96 const responsePromises = []
97
98 // 2.
99 const requestList = []
100
101 // 3.
102 for (let request of requests) {
103 if (request === undefined) {
104 throw webidl.errors.conversionFailed({
105 prefix,
106 argument: 'Argument 1',
107 types: ['undefined is not allowed']
108 })
109 }
110
111 request = webidl.converters.RequestInfo(request)
112
113 if (typeof request === 'string') {
114 continue
115 }
116
117 // 3.1
118 const r = getRequestState(request)
119
120 // 3.2
121 if (!urlIsHttpHttpsScheme(r.url) || r.method !== 'GET') {
122 throw webidl.errors.exception({
123 header: prefix,
124 message: 'Expected http/s scheme when method is not GET.'
125 })
126 }
127 }
128
129 // 4.
130 /** @type {ReturnType<typeof fetching>[]} */
131 const fetchControllers = []
132
133 // 5.
134 for (const request of requests) {
135 // 5.1
136 const r = getRequestState(new Request(request))
137
138 // 5.2
139 if (!urlIsHttpHttpsScheme(r.url)) {
140 throw webidl.errors.exception({
141 header: prefix,
142 message: 'Expected http/s scheme.'
143 })
144 }
145
146 // 5.4

Callers 1

addMethod · 0.95

Calls 13

#batchCacheOperationsMethod · 0.95
queueMicrotaskFunction · 0.85
brandCheckMethod · 0.80
argumentLengthCheckMethod · 0.80
conversionFailedMethod · 0.80
RequestInfoMethod · 0.80
exceptionMethod · 0.80
allMethod · 0.80
rejectMethod · 0.80
urlIsHttpHttpsSchemeFunction · 0.50
fetchingFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected