From 76508814e73d60a4f575d11bf810b8179eebd69b Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Mon, 12 Apr 2021 16:40:45 +0300 Subject: [PATCH] dont fail empty payload Signed-off-by: Vasiliy Tolstov --- jsonpb.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jsonpb.go b/jsonpb.go index 0c2846a..8140f03 100644 --- a/jsonpb.go +++ b/jsonpb.go @@ -72,6 +72,8 @@ func (c *jsonpbCodec) ReadBody(conn io.Reader, b interface{}) error { buf, err := ioutil.ReadAll(conn) if err != nil { return err + } else if buf == nil { + return nil } return JsonpbUnmarshaler.Unmarshal(buf, m) }