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:
parent
e440ec2519
commit
494fe335d3
|
@ -118,7 +118,7 @@ class Middleware::RequestTracker
|
||||||
|
|
||||||
if h[:is_crawler]
|
if h[:is_crawler]
|
||||||
user_agent = env['HTTP_USER_AGENT']
|
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 = user_agent.encode("utf-8")
|
||||||
user_agent.scrub!
|
user_agent.scrub!
|
||||||
end
|
end
|
||||||
|
|
|
@ -65,7 +65,6 @@ describe Hijack do
|
||||||
|
|
||||||
expect(@calls).to eq(1)
|
expect(@calls).to eq(1)
|
||||||
expect(@status).to eq(201)
|
expect(@status).to eq(201)
|
||||||
expect(@status).to be > 0
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue