mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-23 02:17: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:
parent
cc3c206765
commit
d6ef1f9d97
@ -71,7 +71,7 @@ class TelegramBotWebHook {
|
|||||||
} else if (req.method === 'POST') {
|
} else if (req.method === 'POST') {
|
||||||
req
|
req
|
||||||
.pipe(bl(this._parseBody))
|
.pipe(bl(this._parseBody))
|
||||||
.on('end', () => res.end('OK'));
|
.on('finish', () => res.end('OK'));
|
||||||
} else {
|
} else {
|
||||||
// Authorized but not a POST
|
// Authorized but not a POST
|
||||||
debug('WebHook request isn\'t a POST');
|
debug('WebHook request isn\'t a POST');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user