MCPcopy Create free account
hub / github.com/PageLeay/celestial-runtime / clone

Method clone

src.ts/utils/fetch.ts:645–675  ·  view source on GitHub ↗

* Create a new copy of this request.

()

Source from the content-addressed store, hash-verified

643 * Create a new copy of this request.
644 */
645 clone(): FetchRequest {
646 const clone = new FetchRequest(this.url);
647
648 // Preserve "default method" (i.e. null)
649 clone.#method = this.#method;
650
651 // Preserve "default body" with type, copying the Uint8Array is present
652 if (this.#body) { clone.#body = this.#body; }
653 clone.#bodyType = this.#bodyType;
654
655 // Preserve "default headers"
656 clone.#headers = Object.assign({ }, this.#headers);
657
658 // Credentials is readonly, so we copy internally
659 clone.#creds = this.#creds;
660
661 if (this.allowGzip) { clone.allowGzip = true; }
662
663 clone.timeout = this.timeout;
664 if (this.allowInsecureAuthentication) { clone.allowInsecureAuthentication = true; }
665
666 clone.#preflight = this.#preflight;
667 clone.#process = this.#process;
668 clone.#retry = this.#retry;
669
670 clone.#throttle = Object.assign({ }, this.#throttle);
671
672 clone.#getUrlFunc = this.#getUrlFunc;
673
674 return clone;
675 }
676
677 /**
678 * Locks all static configuration for gateways and FetchGetUrlFunc

Callers 3

#sendMethod · 0.95
nextFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected