dont fail empty payload

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-04-12 16:52:10 +03:00
parent 1c774699fe
commit d274240d1d
2 changed files with 21 additions and 0 deletions

View File

@@ -57,6 +57,9 @@ func (c *yamlCodec) ReadBody(conn io.Reader, b interface{}) error {
buf, err := ioutil.ReadAll(conn)
if err != nil {
return err
} else if buf == nil {
// not needed but similar changes in all codecs
return nil
}
return yaml.Unmarshal(buf, b)