1
0
Fork 0
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:
cconstantine 2016-09-16 16:38:58 -07:00
parent 921e939f99
commit ba3037d63e
2 changed files with 6 additions and 4 deletions

View file

@ -2,9 +2,9 @@
module Sidekiq
class WebAction
RACK_SESSION = 'rack.session'
TEXT_HTML = { "Content-Type" => "text/html", "Cache-Control" => "no-cache" }
APPLICATION_JSON = { "Content-Type" => "application/json", "Cache-Control" => "no-cache" }
RACK_SESSION = 'rack.session'.freeze
TEXT_HTML = { "Content-Type" => "text/html", "Cache-Control" => "no-cache" }.freeze
APPLICATION_JSON = { "Content-Type" => "application/json", "Cache-Control" => "no-cache" }.freeze
attr_accessor :env, :block, :type

View file

@ -7,7 +7,7 @@ module Sidekiq
CONTENT_LENGTH = "Content-Length".freeze
CONTENT_TYPE = "Content-Type".freeze
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)
@klass = klass
@ -290,6 +290,8 @@ module Sidekiq
[200, type_header, [resp]]
end
resp[1] = resp[1].dup
resp[1][CONTENT_LENGTH] = resp[2].inject(0) { |l, p| l + p.bytesize }.to_s
resp