Skip to content

Commit

Permalink
Merge pull request #113 from baker-yuan/patch-1
Browse files Browse the repository at this point in the history
fix:http转grpc响应头设置失败
  • Loading branch information
Dot-Liu authored Jun 6, 2023
2 parents 4be1270 + 31176c4 commit 71d19a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion drivers/plugins/http-to-gRPC/complete.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ type StatusErr struct {
func httpHeaderToMD(headers http.Header, additionalHeader map[string]string) []string {
headers.Set("content-type", "application/grpc")
headers.Del("connection")
md := make([]string, len(headers)+len(additionalHeader))
md := make([]string, 0, len(headers)+len(additionalHeader))
//md := metadata.New(map[string]string{})
for key, value := range headers {
if strings.ToLower(key) == "user-agent" {
Expand Down
6 changes: 2 additions & 4 deletions node/http-context/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,8 @@ func (r *ResponseHeader) Headers() http.Header {
func (r *ResponseHeader) SetHeader(key, value string) {

r.cache.Set(key, value)

if r.afterProxy {
r.header.Set(key, value)
} else {
r.header.Set(key, value)
if !r.afterProxy {
r.actions = append(r.actions, &headerAction{
Key: key,
Value: value,
Expand Down

0 comments on commit 71d19a5

Please sign in to comment.