(url?: string, method = 'GET')
| 92 | } |
| 93 | |
| 94 | function getHttpNameFromUrl(url?: string, method = 'GET'): string | undefined { |
| 95 | if (!url) { |
| 96 | return undefined |
| 97 | } |
| 98 | |
| 99 | try { |
| 100 | const parsedUrl = new URL(url) |
| 101 | const path |
| 102 | = parsedUrl.pathname === '/' ? parsedUrl.hostname : parsedUrl.pathname |
| 103 | |
| 104 | return `${method} ${path}` |
| 105 | } |
| 106 | catch { |
| 107 | return undefined |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | function escapeRegExp(value: string): string { |
| 112 | return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') |
no outgoing calls
no test coverage detected