123456789_123456789_123456789_123456789_123456789_

Class: Rack::RewindableInput::Middleware

Relationships & Source Files
Inherits: Object
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).

Class Method Summary

Instance Method Summary

Constructor Details

.new(app) ⇒ Middleware

[ GitHub ]

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

def initialize(app)
  @app = app
end

Instance Method Details

#call(env)

[ GitHub ]

  
# 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