public bool MoveNext()
    {
        if (_hasMultipleValues && MoveNextOnStringEnumerator(Current.Key))
        {
            return(true);
        }

        if (_headersType == HeadersType.Headers)
        {
            return(_headersEnumerator.MoveNext()
                ? SetCurrent(_headersEnumerator.Current.Key, _headersEnumerator.Current.Value, _headersEnumerator.CurrentKnownType)
                : false);
        }
        else if (_headersType == HeadersType.Trailers)
        {
            return(_trailersEnumerator.MoveNext()
                ? SetCurrent(_trailersEnumerator.Current.Key, _trailersEnumerator.Current.Value, _trailersEnumerator.CurrentKnownType)
                : false);
        }
        else
        {
            return(_genericEnumerator !.MoveNext()
                ? SetCurrent(_genericEnumerator.Current.Key, _genericEnumerator.Current.Value, default)
                : false);
        }
    }
Example #2
0
 private bool TryGetNextStringEnumerator(out StringValues.Enumerator enumerator)
 {
     if (_genericEnumerator != null)
     {
         if (!_genericEnumerator.MoveNext())
         {
             enumerator = default;
             return(false);
         }
         else
         {
             enumerator      = _genericEnumerator.Current.Value.GetEnumerator();
             KnownHeaderType = default;
             return(true);
         }
     }
     else if (_isTrailers)
     {
         if (!_trailersEnumerator.MoveNext())
         {
             enumerator = default;
             return(false);
         }
         else
         {
             enumerator      = _trailersEnumerator.Current.Value.GetEnumerator();
             KnownHeaderType = _trailersEnumerator.CurrentKnownType;
             return(true);
         }
     }
     else
     {
         if (!_headersEnumerator.MoveNext())
         {
             enumerator = default;
             return(false);
         }
         else
         {
             enumerator      = _headersEnumerator.Current.Value.GetEnumerator();
             KnownHeaderType = _headersEnumerator.CurrentKnownType;
             return(true);
         }
     }
 }