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

Method processResponse

deps/undici/src/lib/web/cache/cache.js:159–187  ·  view source on GitHub ↗
(response)

Source from the content-addressed store, hash-verified

157 fetchControllers.push(fetching({
158 request: r,
159 processResponse (response) {
160 // 1.
161 if (response.type === 'error' || response.status === 206 || response.status < 200 || response.status > 299) {
162 responsePromise.reject(webidl.errors.exception({
163 header: 'Cache.addAll',
164 message: 'Received an invalid status code or the request failed.'
165 }))
166 } else if (response.headersList.contains('vary')) { // 2.
167 // 2.1
168 const fieldValues = getFieldValues(response.headersList.get('vary'))
169
170 // 2.2
171 for (const fieldValue of fieldValues) {
172 // 2.2.1
173 if (fieldValue === '*') {
174 responsePromise.reject(webidl.errors.exception({
175 header: 'Cache.addAll',
176 message: 'invalid vary field value'
177 }))
178
179 for (const controller of fetchControllers) {
180 controller.abort()
181 }
182
183 return
184 }
185 }
186 }
187 },
188 processResponseEndOfBody (response) {
189 // 1.
190 if (response.aborted) {

Callers 2

fetchFinaleFunction · 0.80
fetchFinaleFunction · 0.80

Calls 6

getFieldValuesFunction · 0.85
rejectMethod · 0.80
exceptionMethod · 0.80
getMethod · 0.65
abortMethod · 0.65
containsMethod · 0.45

Tested by

no test coverage detected