File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
lib/travis/api/app/middleware Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ class UserAgentTracker < Middleware
25
25
before ( agent : /^.+$/ ) do
26
26
agent = UserAgent . parse ( request . user_agent )
27
27
case agent . browser
28
- when *WEB_BROWSERS then mark_browser
28
+ when *WEB_BROWSERS then mark_browser ( agent )
29
29
when "curl" , "Wget" then mark ( :console , agent . browser )
30
30
when "travis-api-wrapper" then mark ( :script , :node_js , agent . browser )
31
31
when "TravisPy" then mark ( :script , :python , agent . browser )
@@ -36,10 +36,13 @@ class UserAgentTracker < Middleware
36
36
end
37
37
end
38
38
39
- def mark_browser
39
+ def mark_browser ( agent )
40
40
# allows a JavaScript Client to set X-User-Agent, for instance to "travis-web" in travis-web
41
- x_agent = UserAgent . parse ( env [ 'HTTP_X_USER_AGENT' ] || 'unknown' ) . browser
42
- mark ( :browser , x_agent )
41
+ if env [ 'HTTP_X_USER_AGENT' ]
42
+ mark :browser , UserAgent . parse ( env [ 'HTTP_X_USER_AGENT' ] ) . browser
43
+ else
44
+ mark :browser , agent . browser
45
+ end
43
46
end
44
47
45
48
def mark_travis ( agent )
You can’t perform that action at this time.
0 commit comments