Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

root/branches/1-2-stable/actionpack/lib/action_controller/deprecated_request_methods.rb

Revision 3847, 0.8 kB (checked in by david, 3 years ago)

Mime types are separated by a comma, not semicolon, in the Accept header. Also switch all internal configuration of mime types away from strings and over to Mime::Type [DHH]

Line 
1 module ActionController
2   class AbstractRequest
3     # Determine whether the body of a HTTP call is URL-encoded (default)
4     # or matches one of the registered param_parsers.
5     #
6     # For backward compatibility, the post format is extracted from the
7     # X-Post-Data-Format HTTP header if present.
8     def post_format
9       case content_type.to_s
10       when 'application/xml'
11         :xml
12       when 'application/x-yaml'
13         :yaml
14       else
15         :url_encoded
16       end
17     end
18
19     # Is this a POST request formatted as XML or YAML?
20     def formatted_post?
21       post? && (post_format == :yaml || post_format == :xml)
22     end
23
24     # Is this a POST request formatted as XML?
25     def xml_post?
26       post? && post_format == :xml
27     end
28
29     # Is this a POST request formatted as YAML?
30     def yaml_post?
31       post? && post_format == :yaml
32     end
33   end
34 end
Note: See TracBrowser for help on using the browser.