2019-06-08 21:40:44 +03:00
|
|
|
package grpc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/micro/go-micro/codec"
|
|
|
|
"google.golang.org/grpc"
|
2019-06-11 11:52:35 +03:00
|
|
|
"google.golang.org/grpc/encoding"
|
2019-06-08 21:40:44 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
type response struct {
|
2019-06-11 11:52:35 +03:00
|
|
|
conn *grpc.ClientConn
|
2019-06-08 21:40:44 +03:00
|
|
|
stream grpc.ClientStream
|
2019-06-11 11:52:35 +03:00
|
|
|
codec encoding.Codec
|
2019-06-08 21:40:44 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Read the response
|
|
|
|
func (r *response) Codec() codec.Reader {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// read the header
|
|
|
|
func (r *response) Header() map[string]string {
|
|
|
|
md, err := r.stream.Header()
|
|
|
|
if err != nil {
|
|
|
|
return map[string]string{}
|
|
|
|
}
|
|
|
|
hdr := make(map[string]string)
|
|
|
|
for k, v := range md {
|
|
|
|
hdr[k] = strings.Join(v, ",")
|
|
|
|
}
|
|
|
|
return hdr
|
|
|
|
}
|
|
|
|
|
|
|
|
// Read the undecoded response
|
|
|
|
func (r *response) Read() ([]byte, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|