Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 22 lines (18 sloc) 0.42 kb
e4ad5c7 @josh Add MethodOverride middleware to allow browsers to fake PUT and DELETE m...
josh authored
1 module Rack
2 class MethodOverride
3 HTTP_METHODS = %w(GET HEAD PUT POST DELETE OPTIONS)
4
5 def initialize(app)
6 @app = app
7 end
8
9 def call(env)
10 if env["REQUEST_METHOD"] == "POST"
11 req = Request.new(env)
12 method = req.POST["_method"].upcase
13 if HTTP_METHODS.include?(method)
14 env["REQUEST_METHOD"] = method
15 end
16 end
17
18 @app.call(env)
19 end
20 end
21 end
Something went wrong with that request. Please try again.