Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use indexOf to match url #147

Closed
wants to merge 1 commit into from
Closed

use indexOf to match url #147

wants to merge 1 commit into from

Conversation

AVVS
Copy link
Contributor

@AVVS AVVS commented Jun 11, 2016

No description provided.

@@ -64,7 +64,7 @@ class TelegramBotWebHook {
debug('WebHook request headers: %j', req.headers);

// If there isn't token on URL
if (!this.regex.test(req.url)) {
if (!this.urlValidator(req.url)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you call indexOf() here, so that it be:

if (req.url.indexOf(this.token) === -1) {

Seems simpler and avoids the func call (although the code may be automatically optimized for that, by v8).

GochoMugo added a commit that referenced this pull request Feb 3, 2017
@GochoMugo
Copy link
Collaborator

Done in commit 9d12bdfa41e5f22062543a33cd53798e61dc489f.

Thanks @AVVS!

@GochoMugo GochoMugo closed this Feb 3, 2017
GochoMugo added a commit that referenced this pull request Feb 10, 2017
Added:

1. Add constructor options:
  * (#243) `options.polling.params` (by @GochoMugo, requested-by @sidelux)
1. Add methods:
  * (#74) *TelegramBot#removeReplyListener()* (by @githugger)
1. (#283) Add proper error handling (by @GochoMugo)
1. (#272) Add health-check endpoint (by @mironov)
  * `options.webHook.healthEndpoint`
1. (#152) Add test for TelegramBot#sendDocument() using 'fileOpts'
   param (by @evolun)
1. Document `options.webHook.host` (by @GochoMugo)
1. (#264) Add Bot API version to README (by @kamikazechaser)
1. Add examples:
  - (#271) WebHook on Heroku (by @TheBeastOfCaerbannog)
  - (#274) WebHook on Zeit Now (by @ferrari)

Changed:

1. (#147) Use *String#indexOf()*, instead of *RegExp#test()*, to
   find token in webhook request (by @AVVS)

Fixed:

* Fix bug:
  - (#275, #280) fix es6 syntax error on Node.js v4.x (by @CrazyAbdul)
  - (#276) promise.warning from `request-promise` (by @GochoMugo,
    reported-by @preco21)
  - (#281) fix handling error during polling (by @GochoMugo,
    reported-by @dimawebmaker)
  - (#284) fix error during deletion of already-set webhook, during
    polling (by @GochoMugo, reported-by @dcparga)
1. Fix links in documentation (by @Ni2c2k)
@GochoMugo
Copy link
Collaborator

Shipped in v0.27.0.

GuideUserCom pushed a commit to GuideUserCom/TelegramBot-API-Node.js- that referenced this pull request Sep 3, 2024
passion-27 added a commit to passion-27/node-telegram-bot that referenced this pull request Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants