MCPcopy Create free account
hub / github.com/0010aor/FlashNotes / getUrl

Function getUrl

frontend/src/client/core/request.ts:68–82  ·  view source on GitHub ↗
(config: OpenAPIConfig, options: ApiRequestOptions)

Source from the content-addressed store, hash-verified

66}
67
68const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => {
69 const encoder = config.ENCODE_PATH || encodeURI
70
71 const path = options.url
72 .replace('{api-version}', config.VERSION)
73 .replace(/{(.*?)}/g, (substring: string, group: string) => {
74 if (options.path?.hasOwnProperty(group)) {
75 return encoder(String(options.path[group]))
76 }
77 return substring
78 })
79
80 const url = config.BASE + path
81 return options.query ? url + getQueryString(options.query) : url
82}
83
84export const getFormData = (options: ApiRequestOptions): FormData | undefined => {
85 if (options.formData) {

Callers 1

requestFunction · 0.85

Calls 1

getQueryStringFunction · 0.85

Tested by

no test coverage detected