File tree Expand file tree Collapse file tree 3 files changed +32
-7
lines changed
Expand file tree Collapse file tree 3 files changed +32
-7
lines changed Original file line number Diff line number Diff line change 1+ package qpack
2+
3+ // A HeaderField is a name-value pair. Both the name and value are
4+ // treated as opaque sequences of octets.
5+ type HeaderField struct {
6+ Name string
7+ Value string
8+ }
9+
10+ // IsPseudo reports whether the header field is an HTTP3 pseudo header.
11+ // That is, it reports whether it starts with a colon.
12+ // It is not otherwise guaranteed to be a valid pseudo header field,
13+ // though.
14+ func (hf HeaderField ) IsPseudo () bool {
15+ return len (hf .Name ) != 0 && hf .Name [0 ] == ':'
16+ }
Original file line number Diff line number Diff line change 1+ package qpack
2+
3+ import (
4+ . "github.com/onsi/ginkgo"
5+ . "github.com/onsi/gomega"
6+ )
7+
8+ var _ = Describe ("Header Field" , func () {
9+ It ("says if it is pseudo" , func () {
10+ Expect ((HeaderField {Name : ":status" }).IsPseudo ()).To (BeTrue ())
11+ Expect ((HeaderField {Name : ":authority" }).IsPseudo ()).To (BeTrue ())
12+ Expect ((HeaderField {Name : ":foobar" }).IsPseudo ()).To (BeTrue ())
13+ Expect ((HeaderField {Name : "status" }).IsPseudo ()).To (BeFalse ())
14+ Expect ((HeaderField {Name : "foobar" }).IsPseudo ()).To (BeFalse ())
15+ })
16+ })
Original file line number Diff line number Diff line change 11package qpack
22
3- // A HeaderField is a name-value pair. Both the name and value are
4- // treated as opaque sequences of octets.
5- type HeaderField struct {
6- Name string
7- Value string
8- }
9-
103var staticTableEntries = [... ]HeaderField {
114 {Name : ":authority" },
125 {Name : ":path" , Value : "/" },
You can’t perform that action at this time.
0 commit comments