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

Function applyUrlToQuery

src/renderer/composables/spaces/http/urlQuery.ts:74–93  ·  view source on GitHub ↗
(
  url: string,
  existingQuery: T[],
)

Source from the content-addressed store, hash-verified

72}
73
74export function applyUrlToQuery<T extends HttpUrlQueryItem>(
75 url: string,
76 existingQuery: T[],
77): T[] {
78 const parsed = parseQueryString(splitUrl(url).query)
79 const enabledExisting = existingQuery.filter(q => q.enabled !== false)
80 const disabledExisting = existingQuery.filter(q => q.enabled === false)
81
82 const next = parsed.map((p, i) => {
83 const matched = enabledExisting[i]
84 return {
85 key: p.key,
86 value: p.value,
87 description: matched?.description ?? '',
88 enabled: true,
89 } as T
90 })
91
92 return [...next, ...disabledExisting]
93}

Callers 2

useHttpRequests.tsFile · 0.90
urlQuery.test.tsFile · 0.90

Calls 2

parseQueryStringFunction · 0.85
splitUrlFunction · 0.70

Tested by

no test coverage detected