Exemplo n.º 1
0
 public void PseudoHeaderNotAllowedAfterNonPseudoHeaders()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         ReadOnlyHttp2Headers.Trailers(true, new AsciiString(":name"), new AsciiString("foo"),
                                       new AsciiString("othername"), new AsciiString("goo"),
                                       new AsciiString(":pseudo"), new AsciiString("val"));
     });
 }
Exemplo n.º 2
0
        public void TestIteratorMultipleValues()
        {
            var headers = ReadOnlyHttp2Headers.ServerHeaders(false, new AsciiString("200"), new AsciiString[] {
                new AsciiString("name2"), new AsciiString("value1"),
                new AsciiString("name1"), new AsciiString("value2"),
                new AsciiString("name2"), new AsciiString("value3")
            });
            var itr = headers.GetAll((AsciiString)"name2").GetEnumerator();

            Assert.True(itr.MoveNext());
            Assert.True(AsciiString.ContentEqualsIgnoreCase((AsciiString)"value1", itr.Current));
            Assert.True(itr.MoveNext());
            Assert.True(AsciiString.ContentEqualsIgnoreCase((AsciiString)"value3", itr.Current));
            Assert.False(itr.MoveNext());
        }
Exemplo n.º 3
0
 public void NotKeyValuePairThrows()
 {
     Assert.Throws <ArgumentException>(() => ReadOnlyHttp2Headers.Trailers(false, new AsciiString[] { null }));
 }
Exemplo n.º 4
0
 public void EmptyHeaderNameAllowed()
 {
     ReadOnlyHttp2Headers.Trailers(false, AsciiString.Empty, new AsciiString("foo"));
 }
Exemplo n.º 5
0
 public void NullValuesAreNotAllowed()
 {
     Assert.Throws <ArgumentException>(() => ReadOnlyHttp2Headers.Trailers(true, new AsciiString("foo"), null));
 }
Exemplo n.º 6
0
 public void NullHeaderNameValidated()
 {
     Assert.Throws <Http2Exception>(() => ReadOnlyHttp2Headers.Trailers(true, null, new AsciiString("foo")));
 }
Exemplo n.º 7
0
 private static ReadOnlyHttp2Headers NewTrailers()
 {
     return(ReadOnlyHttp2Headers.Trailers(false, OtherHeaders()));
 }
Exemplo n.º 8
0
 private static ReadOnlyHttp2Headers NewClientHeaders()
 {
     return(ReadOnlyHttp2Headers.ClientHeaders(false, new AsciiString("meth"), new AsciiString("/foo"),
                                               new AsciiString("schemer"), new AsciiString("respect_my_authority"), OtherHeaders()));
 }
Exemplo n.º 9
0
 private static ReadOnlyHttp2Headers NewServerHeaders()
 {
     return(ReadOnlyHttp2Headers.ServerHeaders(false, new AsciiString("200"), OtherHeaders()));
 }
Exemplo n.º 10
0
 public void NullHeaderNameNotChecked()
 {
     ReadOnlyHttp2Headers.Trailers(false, null, null);
 }
Exemplo n.º 11
0
 public void NullTrailersNotAllowed()
 {
     Assert.Throws <NullReferenceException>(() => ReadOnlyHttp2Headers.Trailers(false, (AsciiString[])null));
 }
Exemplo n.º 12
0
        public void TestIsEmpty()
        {
            var headers = ReadOnlyHttp2Headers.Trailers(false);

            Assert.True(headers.IsEmpty);
        }