sanitizeHost function

String? sanitizeHost(
  1. String host,
  2. InternalLogger internalLogger
)

Implementation

String? sanitizeHost(String host, InternalLogger internalLogger) {
  final uri = Uri.tryParse(host);
  if (uri != null) {
    if (uri.hasScheme) {
      internalLogger
          .warn('$host is a url and will be sanitized to: ${uri.host}.');
      host = uri.host;
    }

    return host;
  }

  internalLogger.warn('$host is a not a valid url and will be dropped');
  return null;
}