Parent

Rack::MethodOverride

Public Class Methods

new(app) click to toggle source
# File lib/rack/methodoverride.rb, line 8
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/rack/methodoverride.rb, line 12
def call(env)
  if env["REQUEST_METHOD"] == "POST"
    method = method_override(env)
    if HTTP_METHODS.include?(method)
      env["rack.methodoverride.original_method"] = env["REQUEST_METHOD"]
      env["REQUEST_METHOD"] = method
    end
  end

  @app.call(env)
end
method_override(env) click to toggle source
# File lib/rack/methodoverride.rb, line 24
def method_override(env)
  req = Request.new(env)
  method = req.POST[METHOD_OVERRIDE_PARAM_KEY] ||
    env[HTTP_METHOD_OVERRIDE_HEADER]
  method.to_s.upcase
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.