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