all repos — telegram-bot-api @ b6575a2934b018fc5109ac4b161cc52f51210436

Golang bindings for the Telegram Bot API

Added stream processing of input JSON

Co-authored-by: TJ Horner <me@tjhorner.com>
Dmitriy Kharchenko 43345312+dmitriy-kharchenko@users.noreply.github.com
Wed, 29 Jul 2020 09:51:11 +0300
commit

b6575a2934b018fc5109ac4b161cc52f51210436

parent

20b57111fc7b1d362967c786b2052b4481e6cccb

1 files changed, 1 insertions(+), 10 deletions(-)

jump to
M bot.gobot.go

@@ -579,17 +579,8 @@ err := errors.New("wrong HTTP method required POST")

return nil, err } - payload, err := ioutil.ReadAll(r.Body) - if err != nil { - return nil, err - } - - if err := r.Body.Close(); err != nil { - return nil, err - } - var update Update - err = json.Unmarshal(payload, &update) + err := json.NewDecoder(r.Body).Decode(&update) if err != nil { return nil, err }