retryHintFrom function

Duration? retryHintFrom(
  1. ConnectException error
)

Returns the server-supplied retry delay, or null if neither a RetryInfo detail nor a parseable retry-after header is present.

Implementation

Duration? retryHintFrom(ConnectException error) {
  for (final detail in error.details) {
    if (detail.type == _retryInfoTypePath || detail.type == _retryInfoFullUrl) {
      final d = _decodeRetryInfo(detail.value);
      if (d != null) {
        return d;
      }
    }
  }
  final header = error.metadata[_retryAfterHeader];
  if (header != null) {
    return _parseRetryAfter(header);
  }
  return null;
}