(response)
| 338 | |
| 339 | // https://fetch.spec.whatwg.org/#concept-response-clone |
| 340 | function cloneResponse (response) { |
| 341 | // To clone a response response, run these steps: |
| 342 | |
| 343 | // 1. If response is a filtered response, then return a new identical |
| 344 | // filtered response whose internal response is a clone of response’s |
| 345 | // internal response. |
| 346 | if (response.internalResponse) { |
| 347 | return filterResponse( |
| 348 | cloneResponse(response.internalResponse), |
| 349 | response.type |
| 350 | ) |
| 351 | } |
| 352 | |
| 353 | // 2. Let newResponse be a copy of response, except for its body. |
| 354 | const newResponse = makeResponse({ ...response, body: null }) |
| 355 | |
| 356 | // 3. If response’s body is non-null, then set newResponse’s body to the |
| 357 | // result of cloning response’s body. |
| 358 | if (response.body != null) { |
| 359 | newResponse.body = cloneBody(response.body) |
| 360 | } |
| 361 | |
| 362 | // 4. Return newResponse. |
| 363 | return newResponse |
| 364 | } |
| 365 | |
| 366 | function makeResponse (init) { |
| 367 | return { |
no test coverage detected