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

Commit 6b33e24

Browse files
committed
Add detection of OkHttp
Signed-off-by: Luis H. Mulinari <[email protected]>
1 parent 8bbd4cb commit 6b33e24

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Fix detection of Firefox on iPad.
66
- Fix detection of Linux ARM-based Android.
77
- Add detection of Chromium Edge on Windows.
8+
- Add detection of OkHttp.
89

910
## 0.5.2
1011

all_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,11 @@ var uastrings = []struct {
437437
ua: "curl/7.28.1",
438438
expected: "Browser:curl-7.28.1 Bot:false Mobile:false",
439439
},
440+
{
441+
title: "OkHttp",
442+
ua: "okhttp/4.2.2",
443+
expected: "Browser:OkHttp-4.2.2 Bot:false Mobile:true",
444+
},
440445

441446
// WebKit
442447
{

operating_systems.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ func (p *UserAgent) detectOS(s section) {
285285
if len(s.comment) > 0 {
286286
dalvik(p, s.comment)
287287
}
288+
} else if s.name == "okhttp" {
289+
p.mobile = true
290+
p.browser.Name = "OkHttp"
291+
p.browser.Version = s.version
288292
} else {
289293
// Check whether this is a bot or just a weird browser.
290294
p.undecided = true

0 commit comments

Comments
 (0)