micro-client-http/message.go
Vasiliy Tolstov 5505b1859f lint fixes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-04-25 16:25:32 +03:00

37 lines
711 B
Go

package http
import (
"github.com/unistack-org/micro/v3/client"
)
type httpMessage struct {
payload interface{}
topic string
contentType string
}
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
}
return &httpMessage{
payload: payload,
topic: topic,
contentType: options.ContentType,
}
}
func (h *httpMessage) ContentType() string {
return h.contentType
}
func (h *httpMessage) Topic() string {
return h.topic
}
func (h *httpMessage) Payload() interface{} {
return h.payload
}