MCPcopy Create free account
hub / github.com/ShaanCoding/makeread.me / getUrl

Function getUrl

frontend/openAPI/generated/core/request.ts:84–101  ·  view source on GitHub ↗
(config: OpenAPIConfig, options: ApiRequestOptions)

Source from the content-addressed store, hash-verified

82};
83
84const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => {
85 const encoder = config.ENCODE_PATH || encodeURI;
86
87 const path = options.url
88 .replace('{api-version}', config.VERSION)
89 .replace(/{(.*?)}/g, (substring: string, group: string) => {
90 if (options.path?.hasOwnProperty(group)) {
91 return encoder(String(options.path[group]));
92 }
93 return substring;
94 });
95
96 const url = `${config.BASE}${path}`;
97 if (options.query) {
98 return `${url}${getQueryString(options.query)}`;
99 }
100 return url;
101};
102
103export const getFormData = (options: ApiRequestOptions): FormData | undefined => {
104 if (options.formData) {

Callers 1

requestFunction · 0.85

Calls 1

getQueryStringFunction · 0.85

Tested by

no test coverage detected