mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Freeze shared header object in rack response so the current response's rack headers don't show up in the next request.
This commit is contained in:
parent
921e939f99
commit
ba3037d63e
2 changed files with 6 additions and 4 deletions
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
module Sidekiq
|
module Sidekiq
|
||||||
class WebAction
|
class WebAction
|
||||||
RACK_SESSION = 'rack.session'
|
RACK_SESSION = 'rack.session'.freeze
|
||||||
TEXT_HTML = { "Content-Type" => "text/html", "Cache-Control" => "no-cache" }
|
TEXT_HTML = { "Content-Type" => "text/html", "Cache-Control" => "no-cache" }.freeze
|
||||||
APPLICATION_JSON = { "Content-Type" => "application/json", "Cache-Control" => "no-cache" }
|
APPLICATION_JSON = { "Content-Type" => "application/json", "Cache-Control" => "no-cache" }.freeze
|
||||||
|
|
||||||
attr_accessor :env, :block, :type
|
attr_accessor :env, :block, :type
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ module Sidekiq
|
||||||
CONTENT_LENGTH = "Content-Length".freeze
|
CONTENT_LENGTH = "Content-Length".freeze
|
||||||
CONTENT_TYPE = "Content-Type".freeze
|
CONTENT_TYPE = "Content-Type".freeze
|
||||||
REDIS_KEYS = %w(redis_version uptime_in_days connected_clients used_memory_human used_memory_peak_human)
|
REDIS_KEYS = %w(redis_version uptime_in_days connected_clients used_memory_human used_memory_peak_human)
|
||||||
NOT_FOUND = [404, {"Content-Type" => "text/plain", "X-Cascade" => "pass" }, ["Not Found"]]
|
NOT_FOUND = [404, {"Content-Type" => "text/plain", "X-Cascade" => "pass" }.freeze, ["Not Found"]]
|
||||||
|
|
||||||
def initialize(klass)
|
def initialize(klass)
|
||||||
@klass = klass
|
@klass = klass
|
||||||
|
@ -290,6 +290,8 @@ module Sidekiq
|
||||||
[200, type_header, [resp]]
|
[200, type_header, [resp]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
resp[1] = resp[1].dup
|
||||||
|
|
||||||
resp[1][CONTENT_LENGTH] = resp[2].inject(0) { |l, p| l + p.bytesize }.to_s
|
resp[1][CONTENT_LENGTH] = resp[2].inject(0) { |l, p| l + p.bytesize }.to_s
|
||||||
|
|
||||||
resp
|
resp
|
||||||
|
|
Loading…
Reference in a new issue