DEV: allow handling crawler reqs with no user agent

Followup to e440ec25 we treat no user agent as crawler reqs.
This commit is contained in:
Sam Saffron 2019-12-09 18:40:10 +11:00
parent e440ec2519
commit 494fe335d3
2 changed files with 1 additions and 2 deletions

View File

@ -118,7 +118,7 @@ class Middleware::RequestTracker
if h[:is_crawler]
user_agent = env['HTTP_USER_AGENT']
if user_agent.encoding != Encoding::UTF_8
if user_agent && (user_agent.encoding != Encoding::UTF_8)
user_agent = user_agent.encode("utf-8")
user_agent.scrub!
end

View File

@ -65,7 +65,6 @@ describe Hijack do
expect(@calls).to eq(1)
expect(@status).to eq(201)
expect(@status).to be > 0
end
end