lib/action_dispatch/middleware/server_timing.rb in actionpack-7.0.8.6 vs lib/action_dispatch/middleware/server_timing.rb in actionpack-7.1.0.beta1
- old
+ new
@@ -2,12 +2,10 @@
require "active_support/notifications"
module ActionDispatch
class ServerTiming
- SERVER_TIMING_HEADER = "Server-Timing"
-
class Subscriber # :nodoc:
include Singleton
KEY = :action_dispatch_server_timing_events
def initialize
@@ -65,11 +63,13 @@
header_info = events.group_by(&:name).map do |event_name, events_collection|
"%s;dur=%.2f" % [event_name, events_collection.sum(&:duration)]
end
- header_info.prepend(headers[SERVER_TIMING_HEADER]) if headers[SERVER_TIMING_HEADER].present?
- headers[SERVER_TIMING_HEADER] = header_info.join(", ")
+ if headers[ActionDispatch::Constants::SERVER_TIMING].present?
+ header_info.prepend(headers[ActionDispatch::Constants::SERVER_TIMING])
+ end
+ headers[ActionDispatch::Constants::SERVER_TIMING] = header_info.join(", ")
response
end
end
end