-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90c9691
commit 416d651
Showing
3 changed files
with
32 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package qpack | ||
|
||
// A HeaderField is a name-value pair. Both the name and value are | ||
// treated as opaque sequences of octets. | ||
type HeaderField struct { | ||
Name string | ||
Value string | ||
} | ||
|
||
// IsPseudo reports whether the header field is an HTTP3 pseudo header. | ||
// That is, it reports whether it starts with a colon. | ||
// It is not otherwise guaranteed to be a valid pseudo header field, | ||
// though. | ||
func (hf HeaderField) IsPseudo() bool { | ||
return len(hf.Name) != 0 && hf.Name[0] == ':' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package qpack | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("Header Field", func() { | ||
It("says if it is pseudo", func() { | ||
Expect((HeaderField{Name: ":status"}).IsPseudo()).To(BeTrue()) | ||
Expect((HeaderField{Name: ":authority"}).IsPseudo()).To(BeTrue()) | ||
Expect((HeaderField{Name: ":foobar"}).IsPseudo()).To(BeTrue()) | ||
Expect((HeaderField{Name: "status"}).IsPseudo()).To(BeFalse()) | ||
Expect((HeaderField{Name: "foobar"}).IsPseudo()).To(BeFalse()) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters