* @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)
| 105 | * @returns {string} The URL with the query params added |
| 106 | */ |
| 107 | function 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 |
no test coverage detected
searching dependent graphs…