Class: Rack::RespondToMalformedFormats
- Inherits:
-
Object
- Object
- Rack::RespondToMalformedFormats
- Defined in:
- lib/rack/respond_to_malformed_formats.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ RespondToMalformedFormats
constructor
A new instance of RespondToMalformedFormats.
Constructor Details
#initialize(app, options = {}) ⇒ RespondToMalformedFormats
Returns a new instance of RespondToMalformedFormats.
10 11 12 |
# File 'lib/rack/respond_to_malformed_formats.rb', line 10 def initialize(app, = {}) @app = app end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rack/respond_to_malformed_formats.rb', line 14 def call(env) if malformed_response = respond_to_malformed_parameters(env) input = env["rack.input"] input.rewind logger.error "Error occurred while parsing request.\nInput:\n\n#{input.read}" if logger malformed_response else @app.call(env) end end |