MCPcopy
hub / github.com/di-sukharev/opencommit / constructor

Method constructor

out/cli.cjs:6795–6841  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

6793 }
6794 var Request6 = class _Request {
6795 constructor(input) {
6796 let init = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
6797 let parsedURL;
6798 if (!isRequest2(input)) {
6799 if (input && input.href) {
6800 parsedURL = parseURL(input.href);
6801 } else {
6802 parsedURL = parseURL(`${input}`);
6803 }
6804 input = {};
6805 } else {
6806 parsedURL = parseURL(input.url);
6807 }
6808 let method = init.method || input.method || "GET";
6809 method = method.toUpperCase();
6810 if ((init.body != null || isRequest2(input) && input.body !== null) && (method === "GET" || method === "HEAD")) {
6811 throw new TypeError("Request with GET/HEAD method cannot have body");
6812 }
6813 let inputBody = init.body != null ? init.body : isRequest2(input) && input.body !== null ? clone(input) : null;
6814 Body.call(this, inputBody, {
6815 timeout: init.timeout || input.timeout || 0,
6816 size: init.size || input.size || 0
6817 });
6818 const headers = new Headers6(init.headers || input.headers || {});
6819 if (inputBody != null && !headers.has("Content-Type")) {
6820 const contentType = extractContentType(inputBody);
6821 if (contentType) {
6822 headers.append("Content-Type", contentType);
6823 }
6824 }
6825 let signal = isRequest2(input) ? input.signal : null;
6826 if ("signal" in init) signal = init.signal;
6827 if (signal != null && !isAbortSignal(signal)) {
6828 throw new TypeError("Expected signal to be an instanceof AbortSignal");
6829 }
6830 this[INTERNALS$2] = {
6831 method,
6832 redirect: init.redirect || input.redirect || "follow",
6833 headers,
6834 parsedURL,
6835 signal
6836 };
6837 this.follow = init.follow !== void 0 ? init.follow : input.follow !== void 0 ? input.follow : 20;
6838 this.compress = init.compress !== void 0 ? init.compress : input.compress !== void 0 ? input.compress : true;
6839 this.counter = init.counter || input.counter || 0;
6840 this.agent = init.agent || input.agent;
6841 }
6842 get method() {
6843 return this[INTERNALS$2].method;
6844 }

Callers

nothing calls this directly

Calls 15

abortMethod · 0.95
isRequest2Function · 0.85
parseURLFunction · 0.85
cloneFunction · 0.85
extractContentTypeFunction · 0.85
isAbortSignalFunction · 0.85
processHeaderFunction · 0.85
extractBodyFunction · 0.85
getGlobalOriginFunction · 0.85
makePolicyContainerFunction · 0.85
makeRequest2Function · 0.85
sameOriginFunction · 0.85

Tested by

no test coverage detected