// fromHTTPHeaders converts HTTP headers to application headers. // // Headers are read from 'from' and written to 'to'. The final header collection // is returned. // // If 'to' is nil, a new map will be assigned. func (hm headerMapper) FromHTTPHeaders(from http.Header, to transport.Headers) transport.Headers { prefixLen := len(hm.Prefix) for k := range from { if strings.HasPrefix(k, hm.Prefix) { key := k[prefixLen:] to = to.With(key, from.Get(k)) } // Note: undefined behavior for multiple occurrences of the same header } return to }