class Sidekiq::Web::Application

def call(env)

def call(env)
  action = match(env)
  return [404, {"content-type" => "text/plain", "x-cascade" => "pass"}, ["Not Found"]] unless action
  headers = {
    "content-type" => "text/html",
    "cache-control" => "private, no-store",
    "content-language" => action.locale,
    "content-security-policy" => process_csp(env, CSP_HEADER_TEMPLATE),
    "x-content-type-options" => "nosniff"
  }
  env["response_headers"] = headers
  resp = catch(:halt) do
    Thread.current[:sidekiq_redis_pool] = env[:redis_pool]
    action.instance_exec env, &action.block
  ensure
    Thread.current[:sidekiq_redis_pool] = nil
  end
  case resp
  when Array
    # redirects go here
    resp
  else
    # rendered content goes here
    # we'll let Rack calculate Content-Length for us.
    [200, env["response_headers"], [resp]]
  end
end