We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 22c4d71 commit 8baa0eeCopy full SHA for 8baa0ee
handler.go
@@ -88,9 +88,13 @@ func NewUnaryHandler[Req, Res any](
88
mergeNonProtocolHeaders(conn.ResponseTrailer(), info.responseTrailer)
89
}
90
91
- // Add response headers/trailers from the response into the conn
92
- mergeNonProtocolHeaders(conn.ResponseHeader(), response.Header())
93
- mergeNonProtocolHeaders(conn.ResponseTrailer(), response.Trailer())
+ // Add response headers/trailers from the response into the conn if they exist
+ if len(response.Header()) != 0 {
+ mergeNonProtocolHeaders(conn.ResponseHeader(), response.Header())
94
+ }
95
+ if len(response.Trailer()) != 0 {
96
+ mergeNonProtocolHeaders(conn.ResponseTrailer(), response.Trailer())
97
98
99
return conn.Send(response.Any())
100
0 commit comments