hostHeader method

String hostHeader(
  1. HttpUrl url,
  2. bool includeDefaultPort
)

Implementation

static String hostHeader(HttpUrl url, bool includeDefaultPort) {
  String host = url.host().contains(':') ? '[${url.host()}]' : url.host();
  return includeDefaultPort || url.port() != HttpUrl.defaultPort(url.scheme())
      ? '$host:${url.port()}'
      : host;
}