Header
type Header map[string][]stringAlias for map[string][]string.
Header represents the key-value pairs in a set of HTTP headers. Unlike net/http, keys are canonicalized to their lowercase form.
Methods
Add
View sourcefunc (h Header) Add(key, value string)Add adds the key, value pair to the headers. It appends to any existing values associated with key. The key is case insensitive; it is canonicalized by CanonicalHeaderKey.
Parameters
- key: string
- value: string
Apply
View sourcefunc (h Header) Apply(hs Header)Apply adds all of the headers in hs. In the case of key conflict, values from hs totally overwrite existing values in h.
Parameters
- hs: Header
Del
View sourcefunc (h Header) Del(key string)Del deletes the values associated with key. The key is case insensitive; it is canonicalized by CanonicalHeaderKey.
Parameters
- key: string
Get
View sourcefunc (h Header) Get(key string) stringGet gets the first value associated with the given key. It is case insensitive; CanonicalHeaderKey is used to canonicalize the provided key. If there are no values associated with the key, Get returns "".
Parameters
- key: string
Returns
Keys
View sourcefunc (h Header) Keys() []stringKeys returns all keys in the header collection.
Returns
Reset
View sourcefunc (h Header) Reset(hs Header)Reset deletes all existing headers, and adds all of the headers in hs.
Parameters
- hs: Header
Set
View sourcefunc (h Header) Set(key, value string)Set sets the header entries associated with key to the single element value. It replaces any existing values associated with key. The key is case insensitive; it is canonicalized by CanonicalHeaderKey.
Parameters
- key: string
- value: string
Values
View sourcefunc (h Header) Values(key string) []stringValues returns all values associated with the given key. It is case insensitive; CanonicalHeaderKey is used to canonicalize the provided key. The returned slice is not a copy.
Parameters
- key: string
Returns