fix for latest micro

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-12-16 15:37:49 +03:00
parent a2f089f890
commit 757c458f60
3 changed files with 14 additions and 6 deletions

View File

@@ -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
}