Class: Picnic::Server::FixContentLength
- Inherits:
-
Object
- Object
- Picnic::Server::FixContentLength
- Defined in:
- lib/picnic/server.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ FixContentLength
constructor
A new instance of FixContentLength.
Constructor Details
#initialize(app) ⇒ FixContentLength
Returns a new instance of FixContentLength.
87 88 89 |
# File 'lib/picnic/server.rb', line 87 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
91 92 93 94 95 96 97 |
# File 'lib/picnic/server.rb', line 91 def call(env) status, headers, body = @app.call(env) if headers.has_key?('Content-Length') && headers['Content-Length'].to_i == 0 headers['Content-Length'] = body.body.length.to_s end [status, headers, body] end |