add codec.RawMessage support
All checks were successful
test / test (push) Successful in 2m57s

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2024-12-23 20:55:04 +03:00
parent cbf0a52cb9
commit 3df8637fd4
3 changed files with 17 additions and 155 deletions

View File

@@ -37,6 +37,7 @@ func (c *urlencodeCodec) Marshal(v interface{}, opts ...codec.Option) ([]byte, e
return m.Data, nil
case *pb.Frame:
return m.Data, nil
}
uv, err := rutil.StructURLValues(v, "", []string{"protobuf", "json", "xml", "yaml"})
@@ -70,6 +71,12 @@ func (c *urlencodeCodec) Unmarshal(b []byte, v interface{}, opts ...codec.Option
case *pb.Frame:
m.Data = b
return nil
case *codec.RawMessage:
*m = append((*m)[0:0], b...)
return nil
case codec.RawMessage:
copy(m, b)
return nil
}
mp, err := rutil.URLMap(string(b))