Lines Matching refs:response
33 // https://fetch.spec.whatwg.org/#response-class
52 // https://fetch.spec.whatwg.org/#dom-response-json
68 // 3. Let responseObject be the result of creating a Response object, given a new response,
69 // "response", and this’s relevant Realm.
73 responseObject[kHeaders][kGuard] = 'response'
76 // 4. Perform initialize a response given responseObject, init, and (body, "application/json").
111 // given a new response, "immutable", and this’s relevant Realm.
117 // 5. Set responseObject’s response’s status to status.
123 // 7. Append `Location`/value to responseObject’s response’s header list.
130 // https://fetch.spec.whatwg.org/#dom-response
141 // 1. Set this’s response to a new response.
145 // Realm, whose header list is this’s response’s header list and guard
146 // is "response".
148 this[kHeaders][kGuard] = 'response'
161 // 5. Perform initialize a response given this, init, and bodyWithType.
165 // Returns response’s type, e.g., "cors".
169 // The type getter steps are to return this’s response’s type.
173 // Returns response’s URL, if it has one; otherwise the empty string.
180 // response’s URL is null; otherwise this’s response’s URL,
191 // Returns whether response was obtained through a redirect.
195 // The redirected getter steps are to return true if this’s response’s URL
200 // Returns response’s status.
204 // The status getter steps are to return this’s response’s status.
208 // Returns whether response’s status is an ok status.
212 // The ok getter steps are to return true if this’s response’s status is an
217 // Returns response’s status message.
221 // The statusText getter steps are to return this’s response’s status
226 // Returns response’s headers as Headers.
246 // Returns a clone of response.
258 // 2. Let clonedResponse be the result of cloning this’s response.
299 // https://fetch.spec.whatwg.org/#concept-response-clone
300 function cloneResponse (response) {
301 // To clone a response response, run these steps:
303 // 1. If response is a filtered response, then return a new identical
304 // filtered response whose internal response is a clone of response’s
305 // internal response.
306 if (response.internalResponse) {
308 cloneResponse(response.internalResponse),
309 response.type
313 // 2. Let newResponse be a copy of response, except for its body.
314 const newResponse = makeResponse({ ...response, body: null })
316 // 3. If response’s body is non-null, then set newResponse’s body to the
317 // result of cloning response’s body.
318 if (response.body != null) {
319 newResponse.body = cloneBody(response.body)
357 function makeFilteredResponse (response, state) {
359 internalResponse: response,
363 return new Proxy(response, {
375 // https://fetch.spec.whatwg.org/#concept-filtered-response
376 function filterResponse (response, type) {
377 // Set response to the following filtered response with response as its
378 // internal response, depending on request’s response tainting:
380 // A basic filtered response is a filtered response whose type is "basic"
381 // and header list excludes any headers in internal response’s header list
382 // whose name is a forbidden response-header name.
384 // Note: undici does not implement forbidden response-header names
385 return makeFilteredResponse(response, {
387 headersList: response.headersList
390 // A CORS filtered response is a filtered response whose type is "cors"
391 // and header list excludes any headers in internal response’s header
392 // list whose name is not a CORS-safelisted response-header name, given
393 // internal response’s CORS-exposed header-name list.
395 // Note: undici does not implement CORS-safelisted response-header names
396 return makeFilteredResponse(response, {
398 headersList: response.headersList
401 // An opaque filtered response is a filtered response whose type is
405 return makeFilteredResponse(response, {
413 // An opaque-redirect filtered response is a filtered response whose type
417 return makeFilteredResponse(response, {
441 // https://whatpr.org/fetch/1392.html#initialize-a-response
442 function initializeResponse (response, init, body) {
459 // 3. Set response’s response’s status to init["status"].
461 response[kState].status = init.status
464 // 4. Set response’s response’s status message to init["statusText"].
466 response[kState].statusText = init.statusText
469 // 5. If init["headers"] exists, then fill response’s headers with init["headers"].
471 fill(response[kHeaders], init.headers)
476 // 1. If response's status is a null body status, then throw a TypeError.
477 if (nullBodyStatus.includes(response.status)) {
480 message: 'Invalid response status code ' + response.status
484 // 2. Set response's body to body's body.
485 response[kState].body = body.body
487 // 3. If body's type is non-null and response's header list does not contain
488 // `Content-Type`, then append (`Content-Type`, body's type) to response's header list.
489 if (body.type != null && !response[kState].headersList.contains('Content-Type')) {
490 response[kState].headersList.append('content-type', body.type)