FIX: error in response body to blocked crawlers, showing 500 Internal Server Error with status of 403
This commit is contained in:
parent
b87a089822
commit
526ffc4966
|
@ -201,7 +201,7 @@ module Middleware
|
|||
|
||||
if helper.blocked_crawler?
|
||||
env["discourse.request_tracker.skip"] = true
|
||||
return [403, {}, "Crawler is not allowed!"]
|
||||
return [403, {}, ["Crawler is not allowed!"]]
|
||||
end
|
||||
|
||||
if helper.should_force_anonymous?
|
||||
|
|
|
@ -167,7 +167,7 @@ describe Middleware::AnonymousCache::Helper do
|
|||
"PATH_INFO" => path,
|
||||
"REQUEST_PATH" => path
|
||||
}.merge(options[:headers]))
|
||||
@status = middleware.call(@env).first
|
||||
@status, @response_header, @response = middleware.call(@env)
|
||||
end
|
||||
|
||||
it "applies whitelisted_crawler_user_agents correctly" do
|
||||
|
@ -184,6 +184,7 @@ describe Middleware::AnonymousCache::Helper do
|
|||
}
|
||||
|
||||
expect(@status).to eq(403)
|
||||
expect(@response).to be_an(Array)
|
||||
|
||||
get '/', headers: non_crawler
|
||||
expect(@status).to eq(200)
|
||||
|
|
Loading…
Reference in New Issue