Skip to content

getBaseURL

getBaseURL(url) → string · URL

Get the base URL (protocol + host + port) from a URL string.

  • url (required): URL string
bash
echo '{"url": "https://api.example.com:8080/v1/users?page=1"}' | utlx -e 'getBaseURL($input.url)'
# "https://api.example.com:8080"
utlx
{
  base: getBaseURL($input.endpoint)
}

Released under AGPL-3.0.