From 757c458f60df26a34e729a1794950465a47e8020 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Thu, 16 Dec 2021 15:37:49 +0300 Subject: [PATCH] fix for latest micro Signed-off-by: Vasiliy Tolstov --- go.mod | 2 +- go.sum | 4 ++-- message.go | 14 +++++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 86c582a..b28507f 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module go.unistack.org/micro-client-http/v3 go 1.16 -require go.unistack.org/micro/v3 v3.8.11 +require go.unistack.org/micro/v3 v3.8.12 diff --git a/go.sum b/go.sum index a5907df..02d3ec6 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,8 @@ github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTK github.com/silas/dag v0.0.0-20210626123444-3804bac2d6d4/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I= go.unistack.org/micro-proto/v3 v3.1.0 h1:q39FwjFiRZn+Ux/tt+d3bJTmDtsQQWa+3SLYVo1vLfA= go.unistack.org/micro-proto/v3 v3.1.0/go.mod h1:DpRhYCBXlmSJ/AAXTmntvlh7kQkYU6eFvlmYAx4BQS8= -go.unistack.org/micro/v3 v3.8.11 h1:Wv1YopcYNcsN3bW8Mv8v6AF99s0uKBtWQ1M/Ag8QLec= -go.unistack.org/micro/v3 v3.8.11/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA= +go.unistack.org/micro/v3 v3.8.12 h1:ACaHE8ZIHFXqEGPSRvXzND4hcqCSQf04WkzOFY6Y1gQ= +go.unistack.org/micro/v3 v3.8.12/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA= golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/message.go b/message.go index ef69d9f..5b7f95a 100644 --- a/message.go +++ b/message.go @@ -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 +}