add compile-time interface compliance check
All checks were successful
coverage / build (push) Successful in 1m21s
test / test (push) Successful in 2m11s

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2025-10-18 10:40:59 +03:00
parent f1cd388a6c
commit f5ea4d10d0
2 changed files with 140 additions and 7 deletions

44
message.go Normal file
View File

@@ -0,0 +1,44 @@
package http
import (
"go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/metadata"
)
type httpEvent struct {
payload interface{}
topic string
contentType string
opts client.MessageOptions
}
func newHTTPEvent(topic string, payload interface{}, contentType string, opts ...client.MessageOption) client.Message {
options := client.NewMessageOptions(opts...)
if len(options.ContentType) > 0 {
contentType = options.ContentType
}
return &httpEvent{
payload: payload,
topic: topic,
contentType: contentType,
opts: options,
}
}
func (c *httpEvent) ContentType() string {
return c.contentType
}
func (c *httpEvent) Topic() string {
return c.topic
}
func (c *httpEvent) Payload() interface{} {
return c.payload
}
func (c *httpEvent) Metadata() metadata.Metadata {
return c.opts.Metadata
}