MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / parseUrl2QueryParams

Function parseUrl2QueryParams

frontend/packages/common/src/utils/curl.ts:357–370  ·  view source on GitHub ↗
(url: string, isCompleteUrl = true)

Source from the content-addressed store, hash-verified

355 }
356}
357const parseUrl2QueryParams = (url: string, isCompleteUrl = true) => {
358 const index = url.indexOf('?')
359 if (index === -1 && isCompleteUrl) {
360 return {}
361 }
362 const queryStr = url.substring(index + 1)
363 const queryParamsArr = queryStr.split('&')
364 const res: { [key: string]: string } = {}
365 for (const item of queryParamsArr) {
366 const [key, value] = item.split('=')
367 res[key] = value
368 }
369 return res
370}
371// https://github.com/jimmycuadra/shellwords/blob/main/src/shellwords.ts
372const scan = (string: string, pattern: RegExp, callback: (match: RegExpMatchArray) => void) => {
373 let result = ''

Callers 2

parseCurlMethod · 0.85
getRequestBody2jsonMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected