codec - Allow to Write() nil body (#1905)

* codec - Allow to Write() nil body

* Oops we are in v3 now
This commit is contained in:
Maarten Bezemer
2020-08-06 19:51:00 +02:00
committed by GitHub
parent fb8533b74e
commit 74907987d1
4 changed files with 61 additions and 0 deletions

View File

@@ -33,6 +33,10 @@ func (c *Codec) ReadBody(b interface{}) error {
}
func (c *Codec) Write(m *codec.Message, b interface{}) error {
if b == nil {
// Nothing to write
return nil
}
p, ok := b.(proto.Message)
if !ok {
return codec.ErrInvalidMessage