()
| 228 | |
| 229 | // Returns a clone of response. |
| 230 | clone () { |
| 231 | webidl.brandCheck(this, Response) |
| 232 | |
| 233 | // 1. If this is unusable, then throw a TypeError. |
| 234 | if (bodyUnusable(this.#state)) { |
| 235 | throw webidl.errors.exception({ |
| 236 | header: 'Response.clone', |
| 237 | message: 'Body has already been consumed.' |
| 238 | }) |
| 239 | } |
| 240 | |
| 241 | // 2. Let clonedResponse be the result of cloning this’s response. |
| 242 | const clonedResponse = cloneResponse(this.#state) |
| 243 | |
| 244 | // Note: To re-register because of a new stream. |
| 245 | // Don't set finalizers other than for fetch responses. |
| 246 | if (this.#state.urlList.length !== 0 && this.#state.body?.stream) { |
| 247 | streamRegistry.register(this, new WeakRef(this.#state.body.stream)) |
| 248 | } |
| 249 | |
| 250 | // 3. Return the result of creating a Response object, given |
| 251 | // clonedResponse, this’s headers’s guard, and this’s relevant Realm. |
| 252 | return fromInnerResponse(clonedResponse, getHeadersGuard(this.#headers)) |
| 253 | } |
| 254 | |
| 255 | [nodeUtil.inspect.custom] (depth, options) { |
| 256 | if (options.depth === null) { |
nothing calls this directly
no test coverage detected