Skip to content

Commit

Permalink
Merge pull request #78 from luismulinari/okhttp
Browse files Browse the repository at this point in the history
Add detection of OkHttp
  • Loading branch information
mssola committed Feb 15, 2021
2 parents 8bbd4cb + 6b33e24 commit 118f000
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Fix detection of Firefox on iPad.
- Fix detection of Linux ARM-based Android.
- Add detection of Chromium Edge on Windows.
- Add detection of OkHttp.

## 0.5.2

Expand Down
5 changes: 5 additions & 0 deletions all_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,11 @@ var uastrings = []struct {
ua: "curl/7.28.1",
expected: "Browser:curl-7.28.1 Bot:false Mobile:false",
},
{
title: "OkHttp",
ua: "okhttp/4.2.2",
expected: "Browser:OkHttp-4.2.2 Bot:false Mobile:true",
},

// WebKit
{
Expand Down
4 changes: 4 additions & 0 deletions operating_systems.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ func (p *UserAgent) detectOS(s section) {
if len(s.comment) > 0 {
dalvik(p, s.comment)
}
} else if s.name == "okhttp" {
p.mobile = true
p.browser.Name = "OkHttp"
p.browser.Version = s.version
} else {
// Check whether this is a bot or just a weird browser.
p.undecided = true
Expand Down

0 comments on commit 118f000

Please sign in to comment.