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:
parent
9d5a6d7fa7
commit
f97d16acad
3 changed files with 9 additions and 9 deletions
|
@ -148,7 +148,7 @@ module Sidekiq
|
||||||
m = middlewares
|
m = middlewares
|
||||||
|
|
||||||
rules = []
|
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
|
::Rack::Builder.new do
|
||||||
use Rack::Static, urls: ["/stylesheets", "/images", "/javascripts"],
|
use Rack::Static, urls: ["/stylesheets", "/images", "/javascripts"],
|
||||||
|
|
|
@ -15,11 +15,11 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
|
|
||||||
def halt(res)
|
def halt(res)
|
||||||
throw :halt, [res, {"Content-Type" => "text/plain"}, [res.to_s]]
|
throw :halt, [res, {"content-type" => "text/plain"}, [res.to_s]]
|
||||||
end
|
end
|
||||||
|
|
||||||
def redirect(location)
|
def redirect(location)
|
||||||
throw :halt, [302, {"Location" => "#{request.base_url}#{location}"}, []]
|
throw :halt, [302, {"location" => "#{request.base_url}#{location}"}, []]
|
||||||
end
|
end
|
||||||
|
|
||||||
def params
|
def params
|
||||||
|
@ -68,7 +68,7 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
|
|
||||||
def json(payload)
|
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
|
end
|
||||||
|
|
||||||
def initialize(env, block)
|
def initialize(env, block)
|
||||||
|
|
|
@ -312,7 +312,7 @@ module Sidekiq
|
||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
action = self.class.match(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
|
app = @klass
|
||||||
resp = catch(:halt) do
|
resp = catch(:halt) do
|
||||||
|
@ -329,10 +329,10 @@ module Sidekiq
|
||||||
else
|
else
|
||||||
# rendered content goes here
|
# rendered content goes here
|
||||||
headers = {
|
headers = {
|
||||||
"Content-Type" => "text/html",
|
"content-type" => "text/html",
|
||||||
"Cache-Control" => "private, no-store",
|
"cache-control" => "private, no-store",
|
||||||
"Content-Language" => action.locale,
|
"content-language" => action.locale,
|
||||||
"Content-Security-Policy" => CSP_HEADER
|
"content-security-policy" => CSP_HEADER
|
||||||
}
|
}
|
||||||
# we'll let Rack calculate Content-Length for us.
|
# we'll let Rack calculate Content-Length for us.
|
||||||
[200, headers, [resp]]
|
[200, headers, [resp]]
|
||||||
|
|
Loading…
Reference in a new issue