getServerUrl = (server) => {
  let url = server.host();

  //might be that somebody by mistake duplicated protocol info inside the host field
  //we need to make sure host do not hold protocol info
  if (server.protocol() && !url.includes(`${server.protocol()}://`)) {
    url = `${server.protocol()}://${url}`;
  }

  if (server.hasPathname()) {
    url = `${url}${server.pathname()}`;
  }

  return url;
}
Get server URL from AsyncAPI server object.

@param {object} server - The AsyncAPI server object.

return {string} - The server URL.