prepare v4
Some checks failed
lint / lint (pull_request) Failing after 1m41s
test / test (pull_request) Successful in 3m19s

This commit is contained in:
2025-02-25 16:42:21 +03:00
parent 9526345cd6
commit 7969cfd8c9
10 changed files with 118 additions and 1198 deletions

View File

@@ -1,10 +1,8 @@
package grpc
import (
"strings"
"go.unistack.org/micro/v3/codec"
"go.unistack.org/micro/v3/metadata"
"go.unistack.org/micro/v4/codec"
"go.unistack.org/micro/v4/metadata"
"google.golang.org/grpc"
)
@@ -25,18 +23,19 @@ func (r *response) Header() metadata.Metadata {
if err != nil {
return nil
}
md := metadata.New(len(meta))
for k, v := range meta {
md.Set(k, strings.Join(v, ","))
}
return md
return metadata.Metadata(meta.Copy())
}
// Read the undecoded response
func (r *response) Read() ([]byte, error) {
f := &codec.Frame{}
if err := r.codec.ReadBody(&wrapStream{r.stream}, f); err != nil {
wrap := &wrapStream{r.stream}
_, err := wrap.Read(f.Data)
if err != nil {
return nil, err
}
return f.Data, nil
}