(config: OpenAPIConfig, options: ApiRequestOptions)
| 66 | } |
| 67 | |
| 68 | const 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 | |
| 84 | export const getFormData = (options: ApiRequestOptions): FormData | undefined => { |
| 85 | if (options.formData) { |
no test coverage detected