MCPcopy
hub / github.com/nodejs/undici / serializePathWithQuery

Function serializePathWithQuery

lib/core/util.js:107–119  ·  view source on GitHub ↗

* @param {string} url The URL to add the query params to * @param {import('node:querystring').ParsedUrlQueryInput} queryParams The object to serialize into a URL query string * @returns {string} The URL with the query params added

(url, queryParams)

Source from the content-addressed store, hash-verified

105 * @returns {string} The URL with the query params added
106 */
107function serializePathWithQuery (url, queryParams) {
108 if (pathHasQueryOrFragment(url)) {
109 throw new Error('Query params cannot be passed when url already contains "?" or "#".')
110 }
111
112 const stringified = stringify(queryParams)
113
114 if (stringified) {
115 url += '?' + stringified
116 }
117
118 return url
119}
120
121/**
122 * @param {number|string|undefined} port

Callers 4

constructorMethod · 0.85
constructorMethod · 0.85
getMockDispatchFunction · 0.85
makeCacheKeyFunction · 0.85

Calls 2

pathHasQueryOrFragmentFunction · 0.85
stringifyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…