Permalink
Browse files

add support for PATCH verb to Rack::MethodOverride

  • Loading branch information...
1 parent e3ffeac commit 889e2bcd658b9437d7fd5e023b59ad868e38f878 @rkh rkh committed Mar 18, 2011
Showing with 3 additions and 3 deletions.
  1. +1 −1 lib/rack/methodoverride.rb
  2. +2 −2 test/spec_methodoverride.rb
@@ -1,6 +1,6 @@
module Rack
class MethodOverride
- HTTP_METHODS = %w(GET HEAD PUT POST DELETE OPTIONS)
+ HTTP_METHODS = %w(GET HEAD PUT POST DELETE OPTIONS PATCH)
METHOD_OVERRIDE_PARAM_KEY = "_method".freeze
HTTP_METHOD_OVERRIDE_HEADER = "HTTP_X_HTTP_METHOD_OVERRIDE".freeze
@@ -22,12 +22,12 @@
should "modify REQUEST_METHOD for POST requests when X-HTTP-Method-Override is set" do
env = Rack::MockRequest.env_for("/",
:method => "POST",
- "HTTP_X_HTTP_METHOD_OVERRIDE" => "PUT"
+ "HTTP_X_HTTP_METHOD_OVERRIDE" => "PATCH"
)
app = Rack::MethodOverride.new(lambda{|envx| Rack::Request.new(envx) })
req = app.call(env)
- req.env["REQUEST_METHOD"].should.equal "PUT"
+ req.env["REQUEST_METHOD"].should.equal "PATCH"
end
should "not modify REQUEST_METHOD if the method is unknown" do

0 comments on commit 889e2bc

Please sign in to comment.