next.js/packages/next/src/server/route-modules/app-route/helpers/clean-url.ts
clean-url.ts15 lines300 B
/**
 * Cleans a URL by stripping the protocol, host, and search params.
 *
 * @param urlString the url to clean
 * @returns the cleaned url
 */

export function cleanURL(url: string | URL): URL {
  const u = new URL(url)
  u.host = 'localhost:3000'
  u.search = ''
  u.protocol = 'http'
  return u
}
Quest for Codev2.0.0
/
SIGN IN