MCPcopy Create free account
hub / github.com/massCodeIO/massCode / splitUrl

Function splitUrl

src/renderer/components/http/requestPreview.ts:19–31  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

17}
18
19function splitUrl(url: string): {
20 path: string
21 query: string
22 fragment: string
23} {
24 const hashIdx = url.indexOf('#')
25 const fragment = hashIdx === -1 ? '' : url.slice(hashIdx)
26 const beforeHash = hashIdx === -1 ? url : url.slice(0, hashIdx)
27 const qIdx = beforeHash.indexOf('?')
28 const path = qIdx === -1 ? beforeHash : beforeHash.slice(0, qIdx)
29 const query = qIdx === -1 ? '' : beforeHash.slice(qIdx + 1)
30 return { path, query, fragment }
31}
32
33function buildQueryString(query: HttpRequestDraft['query']): string {
34 return query

Callers 2

buildPreviewUrlFunction · 0.70
getHttpUrlPartsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected