2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-22 18:07:16 +00:00

Fixes stream end event never being called

For writable streams, like `http.ClientRequest`, there is no `end` event, only `finish`. Thus, `req.end` was never called and never sending a response.

This resulted in a nasty bug for WebHook users that basically rendered the library useless because if Telegram doesn't receive a response from the bot server, it will continue to queue and send requests until it does, or until 24 hours have passed.
This commit is contained in:
icdevin 2016-04-25 16:03:36 +09:00 committed by Yago
parent cc3c206765
commit d6ef1f9d97

View File

@ -71,7 +71,7 @@ class TelegramBotWebHook {
} else if (req.method === 'POST') {
req
.pipe(bl(this._parseBody))
.on('end', () => res.end('OK'));
.on('finish', () => res.end('OK'));
} else {
// Authorized but not a POST
debug('WebHook request isn\'t a POST');