codec: fix noop codec
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
@@ -102,10 +102,10 @@ func (c *noopCodec) Marshal(v interface{}) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *noopCodec) Unmarshal(d []byte, v interface{}) error {
|
func (c *noopCodec) Unmarshal(d []byte, v interface{}) error {
|
||||||
|
var err error
|
||||||
if v == nil {
|
if v == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ve := v.(type) {
|
switch ve := v.(type) {
|
||||||
case string:
|
case string:
|
||||||
ve = string(d)
|
ve = string(d)
|
||||||
@@ -119,6 +119,9 @@ func (c *noopCodec) Unmarshal(d []byte, v interface{}) error {
|
|||||||
ve.Data = d
|
ve.Data = d
|
||||||
case *Message:
|
case *Message:
|
||||||
ve.Body = d
|
ve.Body = d
|
||||||
|
default:
|
||||||
|
err = ErrInvalidMessage
|
||||||
}
|
}
|
||||||
return ErrInvalidMessage
|
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user