From 66d47cc82476736c3648def60484f718de393bcc Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Mon, 23 Dec 2024 20:53:47 +0300 Subject: [PATCH] add codec.RawMessage support Signed-off-by: Vasiliy Tolstov --- jsonpb.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jsonpb.go b/jsonpb.go index 9dd66a2..d1b6eaa 100644 --- a/jsonpb.go +++ b/jsonpb.go @@ -153,6 +153,10 @@ func (c *jsonpbCodecV2) Marshal(d []byte, v interface{}, opts ...codec.Option) ( } } return marshalOptions.MarshalAppend(d[:0], m) + case codec.RawMessage: + return []byte(m), nil + case *codec.RawMessage: + return []byte(*m), nil default: return nil, codec.ErrInvalidMessage }