Documentation
¶
Index ¶
- Constants
- func ReturnSorter(hs *HeaderSorter)
- func SortedKeyValues(h http.Header, exclude map[string]bool) (kvs []HeaderKeyValues, hs *HeaderSorter)
- func SortedKeyValuesBy(h http.Header, order map[string]int, exclude map[string]bool) (kvs []HeaderKeyValues, hs *HeaderSorter)
- type HeaderKeyValues
- type HeaderSorter
Constants ¶
View Source
const ( // HeaderOrderKey is a magic key for ResponseWriter.Header map keys // that, if present, defines a header order that will be used to // write the headers onto wire. The order of the list defined how the headers // will be sorted. A defined key goes before an undefined key. // // This is the only way to specify some order, because maps don't // have a a stable iteration order. If no order is given, headers will // be sorted lexicographically. // // According to RFC-2616 it is good practice to send general-header fields // first, followed by request-header or response-header fields and ending // with entity-header fields. HeaderOrderKey = "Header-Order:" // PHeaderOrderKey is a magic key for setting http3 pseudo header order. // If the header is nil it will use regular GoLang header order. // Valid fields are :authority, :method, :path, :scheme, :protocol PHeaderOrderKey = "PHeader-Order:" )
Variables ¶
This section is empty.
Functions ¶
func ReturnSorter ¶
func ReturnSorter(hs *HeaderSorter)
ReturnSorter returns a header sorter to the pool
func SortedKeyValues ¶
func SortedKeyValues(h http.Header, exclude map[string]bool) (kvs []HeaderKeyValues, hs *HeaderSorter)
SortedKeyValues returns h's keys sorted in the returned kvs slice. The HeaderSorter used to sort is also returned, for possible return to headerSorterPool.
func SortedKeyValuesBy ¶
func SortedKeyValuesBy( h http.Header, order map[string]int, exclude map[string]bool, ) (kvs []HeaderKeyValues, hs *HeaderSorter)
SortedKeyValuesBy returns headers sorted by specified order
Types ¶
type HeaderKeyValues ¶
HeaderKeyValues represents a key-value pair for headers
type HeaderSorter ¶
type HeaderSorter struct {
// contains filtered or unexported fields
}
A HeaderSorter implements sort.Interface by sorting a []HeaderKeyValues by key. It's used as a pointer, so it can fit in a sort.Interface interface value without allocation.
func (*HeaderSorter) Len ¶
func (s *HeaderSorter) Len() int
func (*HeaderSorter) Less ¶
func (s *HeaderSorter) Less(i, j int) bool
func (*HeaderSorter) Swap ¶
func (s *HeaderSorter) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.