Class: Swee::ContentLength
- Defined in:
- lib/swee/middlewaves/content_length.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ ContentLength
constructor
A new instance of ContentLength.
Constructor Details
#initialize(app) ⇒ ContentLength
Returns a new instance of ContentLength.
5 6 7 |
# File 'lib/swee/middlewaves/content_length.rb', line 5 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 |
# File 'lib/swee/middlewaves/content_length.rb', line 9 def call(env) status, headers, body = @app.call(env) headers.merge!( { "Content-Length" => calc_length(body) } ) [status, headers, body] end |