This commit is contained in:
Philip Cheung 2024-10-07 18:28:39 +08:00
parent ec1efb4189
commit a365ea0333
1 changed files with 2 additions and 2 deletions

View File

@ -72,7 +72,6 @@ const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => {
const encoder = config.ENCODE_PATH || encodeURI const encoder = config.ENCODE_PATH || encodeURI
const path = options.url const path = options.url
.replace("{http", "https")
.replace("{api-version}", config.VERSION) .replace("{api-version}", config.VERSION)
.replace(/{(.*?)}/g, (substring: string, group: string) => { .replace(/{(.*?)}/g, (substring: string, group: string) => {
if (options.path?.hasOwnProperty(group)) { if (options.path?.hasOwnProperty(group)) {
@ -81,7 +80,8 @@ const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => {
return substring return substring
}) })
const url = config.BASE + path let url = config.BASE + path
url = url.replace(/^http:\/\//i, 'https://')
return options.query ? url + getQueryString(options.query) : url return options.query ? url + getQueryString(options.query) : url
} }