MCPcopy Index your code
hub / github.com/massCodeIO/massCode / getHttpNameFromUrl

Function getHttpNameFromUrl

src/main/api/routes/captures.ts:94–109  ·  view source on GitHub ↗
(url?: string, method = 'GET')

Source from the content-addressed store, hash-verified

92}
93
94function 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
111function escapeRegExp(value: string): string {
112 return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')

Callers 1

resolveCaptureNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected