Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Commit

Permalink
Add detection of OkHttp
Browse files Browse the repository at this point in the history
Signed-off-by: Luis H. Mulinari <[email protected]>
  • Loading branch information
luismulinari committed Feb 11, 2021
1 parent 8bbd4cb commit 6b33e24
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 6b33e24

Please sign in to comment.