MCPcopy Create free account
hub / github.com/di-sukharev/opencommit / buildBaseUrl

Function buildBaseUrl

out/cli.cjs:77410–77430  ·  view source on GitHub ↗
(endpoint, options)

Source from the content-addressed store, hash-verified

77408 }
77409 const searchPieces = [];
77410 for (const [name, value] of url2.searchParams) {
77411 searchPieces.push(`${name}=${value}`);
77412 }
77413 url2.search = searchPieces.length ? `?${searchPieces.join("&")}` : "";
77414 return url2;
77415}
77416function buildBaseUrl(endpoint, options) {
77417 var _a5;
77418 if (!options.pathParameters) {
77419 return endpoint;
77420 }
77421 const pathParams = options.pathParameters;
77422 for (const [key, param] of Object.entries(pathParams)) {
77423 if (param === void 0 || param === null) {
77424 throw new Error(`Path parameters ${key} must not be undefined or null`);
77425 }
77426 if (!param.toString || typeof param.toString !== "function") {
77427 throw new Error(`Path parameters must be able to be represented as string, ${key} can't`);
77428 }
77429 let value = param.toISOString !== void 0 ? param.toISOString() : String(param);
77430 if (!options.skipUrlEncoding) {
77431 value = encodeURIComponent(param);
77432 }
77433 endpoint = (_a5 = replaceAll(endpoint, `{${key}}`, value)) !== null && _a5 !== void 0 ? _a5 : "";

Callers 1

buildRequestUrlFunction · 0.85

Calls 2

replaceAllFunction · 0.85
entriesMethod · 0.45

Tested by

no test coverage detected