function getPort(opts, defaultPort) {
  let port = opts.port || opts.defaultPort
  if (!port) {
    port = defaultPort
  }

  return port
}
Determines the port based on http opts

@param {object} opts HTTP request options
@param {number} defaultPort the default port
@returns {number} port