fix for latest micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
a2f089f890
commit
757c458f60
2
go.mod
2
go.mod
@ -2,4 +2,4 @@ module go.unistack.org/micro-client-http/v3
|
||||
|
||||
go 1.16
|
||||
|
||||
require go.unistack.org/micro/v3 v3.8.11
|
||||
require go.unistack.org/micro/v3 v3.8.12
|
||||
|
4
go.sum
4
go.sum
@ -8,8 +8,8 @@ github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTK
|
||||
github.com/silas/dag v0.0.0-20210626123444-3804bac2d6d4/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
|
||||
go.unistack.org/micro-proto/v3 v3.1.0 h1:q39FwjFiRZn+Ux/tt+d3bJTmDtsQQWa+3SLYVo1vLfA=
|
||||
go.unistack.org/micro-proto/v3 v3.1.0/go.mod h1:DpRhYCBXlmSJ/AAXTmntvlh7kQkYU6eFvlmYAx4BQS8=
|
||||
go.unistack.org/micro/v3 v3.8.11 h1:Wv1YopcYNcsN3bW8Mv8v6AF99s0uKBtWQ1M/Ag8QLec=
|
||||
go.unistack.org/micro/v3 v3.8.11/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA=
|
||||
go.unistack.org/micro/v3 v3.8.12 h1:ACaHE8ZIHFXqEGPSRvXzND4hcqCSQf04WkzOFY6Y1gQ=
|
||||
go.unistack.org/micro/v3 v3.8.12/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA=
|
||||
golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
|
14
message.go
14
message.go
@ -2,24 +2,28 @@ package http
|
||||
|
||||
import (
|
||||
"go.unistack.org/micro/v3/client"
|
||||
"go.unistack.org/micro/v3/metadata"
|
||||
)
|
||||
|
||||
type httpMessage struct {
|
||||
payload interface{}
|
||||
topic string
|
||||
contentType string
|
||||
opts client.MessageOptions
|
||||
}
|
||||
|
||||
func newHTTPMessage(topic string, payload interface{}, contentType string, opts ...client.MessageOption) client.Message {
|
||||
options := client.NewMessageOptions(opts...)
|
||||
if len(options.ContentType) == 0 {
|
||||
options.ContentType = contentType
|
||||
|
||||
if len(options.ContentType) > 0 {
|
||||
contentType = options.ContentType
|
||||
}
|
||||
|
||||
return &httpMessage{
|
||||
payload: payload,
|
||||
topic: topic,
|
||||
contentType: options.ContentType,
|
||||
contentType: contentType,
|
||||
opts: options,
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,3 +38,7 @@ func (h *httpMessage) Topic() string {
|
||||
func (h *httpMessage) Payload() interface{} {
|
||||
return h.payload
|
||||
}
|
||||
|
||||
func (h *httpMessage) Metadata() metadata.Metadata {
|
||||
return h.opts.Metadata
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user