Added stream processing of input JSON

Co-authored-by: TJ Horner <me@tjhorner.com>
bot-api-6.1
Dmitriy Kharchenko 2020-07-29 09:51:11 +03:00 committed by GitHub
parent 20b57111fc
commit b6575a2934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 10 deletions

11
bot.go
View File

@ -579,17 +579,8 @@ func (bot *BotAPI) HandleUpdate(r *http.Request) (*Update, error) {
return nil, err 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 var update Update
err = json.Unmarshal(payload, &update) err := json.NewDecoder(r.Body).Decode(&update)
if err != nil { if err != nil {
return nil, err return nil, err
} }