Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Commit

Permalink
Fix Rack::ContentLength missing constant error
Browse files Browse the repository at this point in the history
  • Loading branch information
binarylogic committed Oct 27, 2017
1 parent 4d7530c commit de5508d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/timber/integrations/rack/http_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def silence_request
end
end

CONTENT_LENGTH_KEY = 'Content-Length'.freeze

def call(env)
request = Util::Request.new(env)

Expand All @@ -126,7 +128,7 @@ def call(env)
Config.instance.logger.info do
http_context_key = Contexts::HTTP.keyspace
http_context = CurrentContext.fetch(http_context_key)
content_length = headers[::Rack::CONTENT_LENGTH]
content_length = headers[CONTENT_LENGTH_KEY]
time_ms = (Time.now - start) * 1000.0

Events::HTTPResponse.new(
Expand Down Expand Up @@ -165,7 +167,7 @@ def call(env)

Config.instance.logger.info do
event_body = capture_response_body? ? body : nil
content_length = headers[::Rack::CONTENT_LENGTH]
content_length = headers[CONTENT_LENGTH_KEY]
time_ms = (Time.now - start) * 1000.0

Events::HTTPResponse.new(
Expand Down

0 comments on commit de5508d

Please sign in to comment.