MCPcopy Index your code
hub / github.com/Kong/insomnia / joinUrlAndQueryString

Function joinUrlAndQueryString

packages/insomnia/src/utils/url/querystring.ts:24–37  ·  view source on GitHub ↗
(url: string, qs: string)

Source from the content-addressed store, hash-verified

22 * Join querystring to URL
23 */
24export const joinUrlAndQueryString = (url: string, qs: string) => {
25 if (!qs) {
26 return url;
27 }
28 if (!url) {
29 return qs;
30 }
31 const [base, ...hashes] = url.split('#');
32 // TODO: Make this work with URLs that have a #hash component
33 const baseUrl = base || '';
34 const joiner = getJoiner(base);
35 const hash = hashes.length ? `#${hashes.join('#')}` : '';
36 return `${baseUrl}${joiner}${qs}${hash}`;
37};
38
39/**
40 * Extract querystring from URL

Callers 8

transformUrlFunction · 0.90
openWebSocketConnectionFunction · 0.90
startListeningFunction · 0.90
RenderedQueryStringFunction · 0.90
interpolateOpenAndSendFunction · 0.90
handleSubmitFunction · 0.90
runFunction · 0.90

Calls 1

getJoinerFunction · 0.85

Tested by

no test coverage detected