(url2, options = {})
| 77375 | return routePath; |
| 77376 | } |
| 77377 | endpoint = buildBaseUrl(endpoint, options); |
| 77378 | routePath = buildRoutePath(routePath, pathParameters, options); |
| 77379 | const requestUrl = appendQueryParams(`${endpoint}/${routePath}`, options); |
| 77380 | const url2 = new URL(requestUrl); |
| 77381 | return url2.toString().replace(/([^:]\/)\/+/g, "$1"); |
| 77382 | } |
| 77383 | function appendQueryParams(url2, options = {}) { |
| 77384 | if (!options.queryParameters) { |
| 77385 | return url2; |
| 77386 | } |
| 77387 | let parsedUrl = new URL(url2); |
| 77388 | const queryParams = options.queryParameters; |
| 77389 | for (const key of Object.keys(queryParams)) { |
| 77390 | const param = queryParams[key]; |
| 77391 | if (param === void 0 || param === null) { |
| 77392 | continue; |
| 77393 | } |
| 77394 | if (!param.toString || typeof param.toString !== "function") { |
| 77395 | throw new Error(`Query parameters must be able to be represented as string, ${key} can't`); |
| 77396 | } |
| 77397 | const value = param.toISOString !== void 0 ? param.toISOString() : param.toString(); |
| 77398 | parsedUrl.searchParams.append(key, value); |
| 77399 | } |
| 77400 | if (options.skipUrlEncoding) { |
| 77401 | parsedUrl = skipQueryParameterEncoding(parsedUrl); |
no test coverage detected