diff --git a/go.mod b/go.mod index d7d1a6b..4b9a42c 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/golang/protobuf v1.4.3 github.com/google/go-cmp v0.5.1 // indirect github.com/unistack-org/micro-codec-bytes v0.0.0-20200828083432-4e49e953d844 - github.com/unistack-org/micro/v3 v3.0.0-gamma.0.20201104214903-1fbf8b2e209e + github.com/unistack-org/micro/v3 v3.0.2-0.20201117210202-01e64cb0c0f3 golang.org/x/net v0.0.0-20200904194848-62affa334b73 golang.org/x/sys v0.0.0-20200803210538-64077c9b5642 // indirect golang.org/x/text v0.3.3 // indirect diff --git a/go.sum b/go.sum index 1b9bc29..08b8ae4 100644 --- a/go.sum +++ b/go.sum @@ -283,6 +283,10 @@ github.com/unistack-org/micro/v3 v3.0.0-gamma.0.20200920135754-1cbd1d2bad83/go.m github.com/unistack-org/micro/v3 v3.0.0-gamma.0.20200922103357-4c4fa00a5d94/go.mod h1:aL+8VhSXpx0SuEeXPOWUo5BgS7kyvWYobeXFay90UUM= github.com/unistack-org/micro/v3 v3.0.0-gamma.0.20201104214903-1fbf8b2e209e h1:v27OUgoE2UOyCe6uLksdpG6oErx62nUXWIkTPxS7yIw= github.com/unistack-org/micro/v3 v3.0.0-gamma.0.20201104214903-1fbf8b2e209e/go.mod h1:LFvCXGOgcLIj2k/8eL71TpIpcJBN2SXXAUx8U6dz9Rw= +github.com/unistack-org/micro/v3 v3.0.2-0.20201114215340-e0ef8b2953b5 h1:iSyQgm4zZb8N/jphp5NOf6bC8FrGRcKNyDDtAeP1m5w= +github.com/unistack-org/micro/v3 v3.0.2-0.20201114215340-e0ef8b2953b5/go.mod h1:LYbzHigEudM10AbLZztVSX0Y4JWgj5nKIExil/99h6E= +github.com/unistack-org/micro/v3 v3.0.2-0.20201117210202-01e64cb0c0f3 h1:knz0mt3Ot/CIXp5dRyb5dAPYtKiWA9PDhazpXX5Iu3o= +github.com/unistack-org/micro/v3 v3.0.2-0.20201117210202-01e64cb0c0f3/go.mod h1:LYbzHigEudM10AbLZztVSX0Y4JWgj5nKIExil/99h6E= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/vultr/govultr v0.1.4/go.mod h1:9H008Uxr/C4vFNGLqKx232C206GL0PBHzOP0809bGNA= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= diff --git a/request.go b/request.go index 76f964d..893c9f8 100644 --- a/request.go +++ b/request.go @@ -3,6 +3,7 @@ package grpc import ( raw "github.com/unistack-org/micro-codec-bytes" "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/metadata" ) type rpcRequest struct { @@ -10,7 +11,7 @@ type rpcRequest struct { method string contentType string codec codec.Codec - header map[string]string + header metadata.Metadata body []byte stream bool payload interface{} @@ -20,7 +21,7 @@ type rpcMessage struct { topic string contentType string payload interface{} - header map[string]string + header metadata.Metadata body []byte codec codec.Codec } @@ -45,7 +46,7 @@ func (r *rpcRequest) Codec() codec.Reader { return r.codec } -func (r *rpcRequest) Header() map[string]string { +func (r *rpcRequest) Header() metadata.Metadata { return r.header } @@ -77,7 +78,7 @@ func (r *rpcMessage) Payload() interface{} { return r.payload } -func (r *rpcMessage) Header() map[string]string { +func (r *rpcMessage) Header() metadata.Metadata { return r.header } diff --git a/response.go b/response.go index fff96a9..a6a52a2 100644 --- a/response.go +++ b/response.go @@ -2,10 +2,11 @@ package grpc import ( "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/metadata" ) type rpcResponse struct { - header map[string]string + header metadata.Metadata codec codec.Codec } @@ -13,7 +14,7 @@ func (r *rpcResponse) Codec() codec.Writer { return r.codec } -func (r *rpcResponse) WriteHeader(hdr map[string]string) { +func (r *rpcResponse) WriteHeader(hdr metadata.Metadata) { for k, v := range hdr { r.header[k] = v }