withHostHeader function

Map<String, String> withHostHeader (
  1. String url
)

Implementation

Map<String, String> withHostHeader(String url) {
  final isNull = url?.isNotEmpty != true;
  final httpStart = url?.startsWith('http') == true;
//  logger.info('url is $url contains ${ServerConnection.getResolvedIp()}');
  final ipIncluded = isNull || AppContext.connection.getResolvedIp() == null
      ? false
      : url.contains(AppContext.connection.getResolvedIp());
  final needHost = isNull || httpStart || !ipIncluded;
  return (needHost || AppContext.env.hostname == null) ? {} : {HttpHeaders.hostHeader: AppContext.env.hostname};
}