Class: Rack::RewindableInput::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/rewindable_input.rb

Overview

Makes rack.input rewindable, for compatibility with applications and middleware designed for earlier versions of Rack (where rack.input was required to be rewindable).

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



19
20
21
# File 'lib/rack/rewindable_input.rb', line 19

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/rack/rewindable_input.rb', line 23

def call(env)
  if (input = env[RACK_INPUT])
    env[RACK_INPUT] = RewindableInput.new(input)
  end

  @app.call(env)
end