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

Method clone

deps/undici/undici.js:12898–12921  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12896 }
12897 // Returns a clone of request.
12898 clone() {
12899 webidl.brandCheck(this, _Request);
12900 if (bodyUnusable(this.#state)) {
12901 throw new TypeError("unusable");
12902 }
12903 const clonedRequest = cloneRequest(this.#state);
12904 const ac = new AbortController();
12905 if (this.signal.aborted) {
12906 ac.abort(this.signal.reason);
12907 } else {
12908 let list = dependentControllerMap.get(this.signal);
12909 if (list === void 0) {
12910 list = /* @__PURE__ */ new Set();
12911 dependentControllerMap.set(this.signal, list);
12912 }
12913 const acRef = new WeakRef(ac);
12914 list.add(acRef);
12915 util.addAbortListener(
12916 ac.signal,
12917 buildAbort(acRef)
12918 );
12919 }
12920 return fromInnerRequest(clonedRequest, this.#dispatcher, ac.signal, getHeadersGuard(this.#headers));
12921 }
12922 [nodeUtil.inspect.custom](depth, options) {
12923 if (options.depth === null) {
12924 options.depth = 2;

Callers

nothing calls this directly

Calls 9

abortMethod · 0.95
brandCheckMethod · 0.80
bodyUnusableFunction · 0.70
cloneRequestFunction · 0.70
buildAbortFunction · 0.70
fromInnerRequestFunction · 0.70
getMethod · 0.65
addMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected