Skip to content

getProtocol

getProtocol(url) → string · URL

Get the protocol/scheme from a URL string.

  • url (required): URL string
bash
echo '{"url": "https://example.com"}' | utlx -e 'getProtocol($input.url)'
# "https"
utlx
{
  protocol: getProtocol($input.url),
  isSecure: getProtocol($input.url) == "https"
}

Released under AGPL-3.0.