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

isBot returns non boolean value 'google' #138

Open
Grant-Lay opened this issue Aug 26, 2020 · 2 comments
Open

isBot returns non boolean value 'google' #138

Grant-Lay opened this issue Aug 26, 2020 · 2 comments

Comments

@Grant-Lay
Copy link

isBot returns false when the user agent is not a bot but returns 'google' when using the google bot user agent. Should it not display true instead and then have a separate property botType which returns google?

@guyius
Copy link

guyius commented Nov 11, 2020

I think this is actually affecting all known bots, https://github.com/biggora/express-useragent/blob/master/lib/express-useragent.js#L806 the function returns the second item in the array from regex exec function which is either a string or null. I can see postman also returns a string for example.

@mehmet-yilmaz
Copy link

Workaround: Use string type in the application and cast the result to the string by _ request.useragent.isBot.toString() _
This works fine in my typescript project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@Grant-Lay @guyius @mehmet-yilmaz and others