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

Commit de5508d

Browse files
committed
Fix Rack::ContentLength missing constant error
1 parent 4d7530c commit de5508d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/timber/integrations/rack/http_events.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ def silence_request
106106
end
107107
end
108108

109+
CONTENT_LENGTH_KEY = 'Content-Length'.freeze
110+
109111
def call(env)
110112
request = Util::Request.new(env)
111113

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

132134
Events::HTTPResponse.new(
@@ -165,7 +167,7 @@ def call(env)
165167

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

171173
Events::HTTPResponse.new(

0 commit comments

Comments
 (0)