functions/index.js
function reqURL(req, newPath) {
  return url.format({
    protocol: 'https', //req.protocol, // by default this returns http which gets redirected
    host: req.get('host'),
    pathname: newPath
  })
}
function reqURL(req, newPath) {
  return url.format({
    protocol: 'https', //req.protocol, // by default this returns http which gets redirected
    host: req.get('host'),
    pathname: newPath
  })
}
function reqURL ( req , newPath ) { return url . format ( { protocol : 'https' , //req.protocol, // by default this returns http which gets redirected host : req . get ( 'host' ) , pathname : newPath } ) }
Retrieve the URL for another endpoint running on the same server, on https.

@param req The express/firebase function request object
@param newPath The endpoint
@returns {string} The URL
Retrieve the URL for another endpoint running on the same server on https .