From 3b0e9fcda2855c4e8aa5fc4c589ce22aa1a080c4 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Mon, 12 Apr 2021 16:39:16 +0300 Subject: [PATCH] dont fail empty payload Signed-off-by: Vasiliy Tolstov --- json.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/json.go b/json.go index 4a4a75a..49c630d 100644 --- a/json.go +++ b/json.go @@ -54,7 +54,12 @@ func (c *jsonCodec) ReadBody(conn io.Reader, b interface{}) error { return nil } - return json.NewDecoder(conn).Decode(b) + err := json.NewDecoder(conn).Decode(b) + if err == io.EOF { + return nil + } + + return err } func (c *jsonCodec) Write(conn io.Writer, m *codec.Message, b interface{}) error {