(req: ZoomInfoProxyRequest)
| 21 | const logger = createLogger('ZoomInfoProxyAPI') |
| 22 | |
| 23 | function buildApiUrl(req: ZoomInfoProxyRequest): string { |
| 24 | const subPath = req.path.startsWith('/') ? req.path : `/${req.path}` |
| 25 | const url = `${ZOOMINFO_API_BASE}${subPath}` |
| 26 | |
| 27 | if (!req.query || Object.keys(req.query).length === 0) { |
| 28 | return url |
| 29 | } |
| 30 | const search = new URLSearchParams() |
| 31 | for (const [key, value] of Object.entries(req.query)) { |
| 32 | if (value === undefined || value === null) continue |
| 33 | search.append(key, String(value)) |
| 34 | } |
| 35 | const queryString = search.toString() |
| 36 | if (!queryString) return url |
| 37 | return url.includes('?') ? `${url}&${queryString}` : `${url}?${queryString}` |
| 38 | } |
| 39 | |
| 40 | interface Invocation { |
| 41 | status: number |
no test coverage detected