function serializePathWithQuery (url, queryParams) {
  if (url.includes('?') || url.includes('#')) {
    throw new Error('Query params cannot be passed when url already contains "?" or "#".')
  }

  const stringified = stringify(queryParams)

  if (stringified) {
    url += '?' + stringified
  }

  return url
}
@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