MCPcopy
hub / github.com/connectrpc/connect-go / mergeNonProtocolHeaders

Function mergeNonProtocolHeaders

header.go:88–100  ·  view source on GitHub ↗

mergeNonProtocolHeaders merges headers excluding protocol headers defined in protocolHeaders.

(into, from http.Header)

Source from the content-addressed store, hash-verified

86// mergeNonProtocolHeaders merges headers excluding protocol headers defined in
87// protocolHeaders.
88func mergeNonProtocolHeaders(into, from http.Header) {
89 for key, vals := range from {
90 if len(vals) == 0 {
91 // For response trailers, net/http will pre-populate entries
92 // with nil values based on the "Trailer" header. But if there
93 // are no actual values for those keys, we skip them.
94 continue
95 }
96 if _, isProtocolHeader := protocolHeaders[key]; !isProtocolHeader {
97 into[key] = append(into[key], vals...)
98 }
99 }
100}
101
102// getHeaderCanonical is a shortcut for Header.Get() which
103// bypasses the CanonicalMIMEHeaderKey operation when we

Callers 5

grpcErrorToTrailerFunction · 0.85
NewUnaryHandlerFunction · 0.85
mergeResponseHeaderMethod · 0.85
MarshalEndStreamMethod · 0.85
writeConnectUnaryMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected