Sha256: e0cba5f6a56fc8924164e8fd738cdeb5e3738e9a09cd4aece4cc8a251a7cafec

Contents?: true

Size: 420 Bytes

Versions: 2

Compression:

Stored size: 420 Bytes

Contents

module Rack
  class MethodOverride
    HTTP_METHODS = %w(GET HEAD PUT POST DELETE OPTIONS)

    def initialize(app)
      @app = app
    end

    def call(env)
      if env["REQUEST_METHOD"] == "POST"
        req = Request.new(env)
        method = req.POST["_method"].upcase
        if HTTP_METHODS.include?(method)
          env["REQUEST_METHOD"] = method
        end
      end

      @app.call(env)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kastner-rack-0.3.171 lib/rack/methodoverride.rb
kastner-rack-0.3.186 lib/rack/methodoverride.rb