Class: Rack::DocunextContentLength
- Inherits:
-
Object
- Object
- Rack::DocunextContentLength
- Defined in:
- lib/rack-docunext-content-length.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ DocunextContentLength
constructor
A new instance of DocunextContentLength.
Constructor Details
#initialize(app) ⇒ DocunextContentLength
Returns a new instance of DocunextContentLength.
6 7 8 |
# File 'lib/rack-docunext-content-length.rb', line 6 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rack-docunext-content-length.rb', line 10 def call(env) status, headers, response = @app.call(env) headers.delete('Content-Length') if status == 304 [status, headers, response] else response_body = "" response.each { |part| response_body += part } headers["Content-Length"] = response_body.length.to_s [status, headers, response_body] end end |