示例#1
0
文件: header.go 项目: yarpc/yarpc-go
// Keys returns a list of header keys defined on this Headers object.
//
// All items in the list will be normalized using CanonicalizeHeaderKey.
func (h Headers) Keys() []string {
	ih := internal.Headers(h)
	keys := make([]string, 0, ih.Len())
	for k := range ih.Items() {
		keys = append(keys, k)
	}
	sort.Strings(keys)
	return keys
}
示例#2
0
文件: header.go 项目: yarpc/yarpc-go
// Items returns the underlying map for this Headers map.
//
// Keys in the map are normalized using CanonicalizeHeaderKey.
//
// The returned map MUST NOT be mutated.
func (h Headers) Items() map[string]string {
	return internal.Headers(h).Items()
}
示例#3
0
文件: header.go 项目: yarpc/yarpc-go
// Len returns the number of headers defined on this object.
func (h Headers) Len() int {
	return internal.Headers(h).Len()
}
示例#4
0
文件: header.go 项目: yarpc/yarpc-go
// Get retrieves the value associated with the given header name.
func (h Headers) Get(k string) (string, bool) {
	return internal.Headers(h).Get(k)
}
示例#5
0
文件: header.go 项目: yarpc/yarpc-go
// Del deletes the header with the given name from the Headers map.
//
// This is a no-op if the key does not exist.
func (h Headers) Del(k string) {
	internal.Headers(h).Del(k)
}
示例#6
0
文件: header.go 项目: yarpc/yarpc-go
// With returns a Headers object with the given key-value pair added to it.
// The returned object MAY not point to the same Headers underlying data store
// as the original Headers so the returned Headers MUST always be used instead
// of the original object.
//
// 	headers = headers.With("foo", "bar").With("baz", "qux")
func (h Headers) With(k, v string) Headers {
	return Headers(internal.Headers(h).With(k, v))
}