mirror of
https://github.com/go-micro/go-micro.git
synced 2025-11-29 21:47:44 +02:00
add all the plugins
This commit is contained in:
40
plugins/client/http/message.go
Normal file
40
plugins/client/http/message.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"github.com/micro/go-micro/v2/client"
|
||||
)
|
||||
|
||||
type httpMessage struct {
|
||||
topic string
|
||||
contentType string
|
||||
payload interface{}
|
||||
}
|
||||
|
||||
func newHTTPMessage(topic string, payload interface{}, contentType string, opts ...client.MessageOption) client.Message {
|
||||
var options client.MessageOptions
|
||||
for _, o := range opts {
|
||||
o(&options)
|
||||
}
|
||||
|
||||
if len(options.ContentType) > 0 {
|
||||
contentType = options.ContentType
|
||||
}
|
||||
|
||||
return &httpMessage{
|
||||
payload: payload,
|
||||
topic: topic,
|
||||
contentType: 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
|
||||
}
|
||||
Reference in New Issue
Block a user