message options
This commit is contained in:
11
message.go
11
message.go
@@ -10,7 +10,16 @@ type httpMessage struct {
|
||||
payload interface{}
|
||||
}
|
||||
|
||||
func newHTTPMessage(topic string, payload interface{}, contentType string) client.Message {
|
||||
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,
|
||||
|
Reference in New Issue
Block a user