1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Rack 2/3 compat: header keys must be lower-case

This commit is contained in:
Mike Perham 2022-08-11 07:22:29 -07:00
parent 9d5a6d7fa7
commit f97d16acad
3 changed files with 9 additions and 9 deletions

View file

@ -148,7 +148,7 @@ module Sidekiq
m = middlewares
rules = []
rules = [[:all, {"Cache-Control" => "public, max-age=86400"}]] unless ENV["SIDEKIQ_WEB_TESTING"]
rules = [[:all, {"cache-control" => "public, max-age=86400"}]] unless ENV["SIDEKIQ_WEB_TESTING"]
::Rack::Builder.new do
use Rack::Static, urls: ["/stylesheets", "/images", "/javascripts"],

View file

@ -15,11 +15,11 @@ module Sidekiq
end
def halt(res)
throw :halt, [res, {"Content-Type" => "text/plain"}, [res.to_s]]
throw :halt, [res, {"content-type" => "text/plain"}, [res.to_s]]
end
def redirect(location)
throw :halt, [302, {"Location" => "#{request.base_url}#{location}"}, []]
throw :halt, [302, {"location" => "#{request.base_url}#{location}"}, []]
end
def params
@ -68,7 +68,7 @@ module Sidekiq
end
def json(payload)
[200, {"Content-Type" => "application/json", "Cache-Control" => "private, no-store"}, [Sidekiq.dump_json(payload)]]
[200, {"content-type" => "application/json", "cache-control" => "private, no-store"}, [Sidekiq.dump_json(payload)]]
end
def initialize(env, block)

View file

@ -312,7 +312,7 @@ module Sidekiq
def call(env)
action = self.class.match(env)
return [404, {"Content-Type" => "text/plain", "X-Cascade" => "pass"}, ["Not Found"]] unless action
return [404, {"content-type" => "text/plain", "x-cascade" => "pass"}, ["Not Found"]] unless action
app = @klass
resp = catch(:halt) do
@ -329,10 +329,10 @@ module Sidekiq
else
# rendered content goes here
headers = {
"Content-Type" => "text/html",
"Cache-Control" => "private, no-store",
"Content-Language" => action.locale,
"Content-Security-Policy" => CSP_HEADER
"content-type" => "text/html",
"cache-control" => "private, no-store",
"content-language" => action.locale,
"content-security-policy" => CSP_HEADER
}
# we'll let Rack calculate Content-Length for us.
[200, headers, [resp]]