0
@@ -14,12 +14,14 @@ module Merb
0
self.parse_json_params = true
0
self.parse_xml_params = true
0
- # Most web browsers can't send PUT or DELETE requests
0
- # Any Strings stored in this array will be used as paramaters
0
- # to find the real method. Common examples are _method and
0
- # fb_sig_request_method
0
- cattr_accessor :browser_method_workarounds
0
- self.browser_method_workarounds = []
0
+ # Flash, and some older browsers can't use arbitrary
0
+ # request methods -- i.e., are limited to GET/POST.
0
+ # These user-agents can make POST requests in combination
0
+ # with these overrides to participate fully in REST
0
+ # Common examples are _method or fb_sig_request_method
0
+ # in the params, or an X-HTTP-Method-Override header
0
+ cattr_accessor :http_method_overrides
0
+ self.http_method_overrides = []
0
# Initial the request object.
0
@@ -38,9 +40,10 @@ module Merb
0
# Symbol:: The name of the request method, e.g. :get.
0
- # If the method is post, then the params specified in
0
- # browser_method_workarounds will be checked for the masquerading method.
0
- # The first matching workaround wins.
0
+ # If the method is post, then the blocks specified in
0
+ # http_method_overrides will be checked for the masquerading method.
0
+ # The block will get the controller yielded to it. The first matching workaround wins.
0
+ # To disable this behavior, set http_method_overrides = []
0
request_method = @env['REQUEST_METHOD'].downcase.to_sym
0
@@ -48,17 +51,9 @@ module Merb
0
when :get, :head, :put, :delete
0
- if self.class.parse_multipart_params
0
- p = body_and_query_params.merge(multipart_params)
0
- p = body_and_query_params
0
- self.class.browser_method_workarounds.each do |workaround|
0
- if p.include?(workaround.to_s)
0
- m = p[workaround.to_s]
0
+ self.class.http_method_overrides.each do |o|
0
+ m ||= o.call(self); break if m
0
METHODS.include?(m) ? m.to_sym : :post