mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-10 08:29:58 +08:00
fix: 5076 (#5083)
Co-authored-by: Kevin Wan <wanjunfeng@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package internal
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/protobuf/jsonpb"
|
||||
"github.com/golang/protobuf/proto"
|
||||
@@ -33,15 +34,32 @@ func (h *EventHandler) OnReceiveResponse(message proto.Message) {
|
||||
}
|
||||
}
|
||||
|
||||
func (h *EventHandler) OnReceiveTrailers(status *status.Status, _ metadata.MD) {
|
||||
func (h *EventHandler) OnReceiveTrailers(status *status.Status, md metadata.MD) {
|
||||
w, ok := h.writer.(http.ResponseWriter)
|
||||
if ok {
|
||||
for k, v := range md {
|
||||
for _, v2 := range v {
|
||||
w.Header().Add(http.CanonicalHeaderKey(k), v2)
|
||||
}
|
||||
}
|
||||
}
|
||||
h.Status = status
|
||||
}
|
||||
|
||||
func (h *EventHandler) OnResolveMethod(_ *desc.MethodDescriptor) {
|
||||
}
|
||||
|
||||
func (h *EventHandler) OnSendHeaders(_ metadata.MD) {
|
||||
}
|
||||
|
||||
func (h *EventHandler) OnReceiveHeaders(_ metadata.MD) {
|
||||
func (h *EventHandler) OnReceiveHeaders(md metadata.MD) {
|
||||
w, ok := h.writer.(http.ResponseWriter)
|
||||
if ok {
|
||||
for k, v := range md {
|
||||
for _, v2 := range v {
|
||||
canonicalKey := http.CanonicalHeaderKey(k)
|
||||
for _, v2 := range v {
|
||||
w.Header().Add(canonicalKey, v2)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user