Changeset 1336
- Timestamp:
- 05/20/05 18:32:04 (3 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (2 diffs)
- trunk/actionpack/lib/action_controller/cgi_process.rb (modified) (1 diff)
- trunk/actionpack/lib/action_controller/request.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r1334 r1336 19 19 * Added accessors to logger, params, response, session, flash, and headers from the view, so you can write <% logger.info "stuff" %> instead of <% @logger.info "others" %> -- more consistent with the preferred way of accessing these attributes and collections from the controller 20 20 21 * Added support for POST data in form of YAML or XML, which is controller through the X-POST_DATA_MARSHALheader. Example request:22 23 X-POST_DATA_MARSHAL:xml21 * Added support for POST data in form of YAML or XML, which is controller through the Content-Type header. Example request: 22 23 Content-Type: application/xml 24 24 <request><item><content>HelloWorld</content></item></request> 25 25 26 26 ...is the same as: 27 27 28 X-POST_DATA_MARSHAL:yaml28 Content-Type: application/x-yaml 29 29 --- 30 30 item: … … 39 39 Example Curl call: 40 40 41 curl -H ' X-POST_DATA_MARSHAL:xml' -d '<request><item><content>KillMeMore</content></item></request>' http://www.example.com/service41 curl -H 'Content-Type: application/xml' -d '<request><item><content>KillMeMore</content></item></request>' http://www.example.com/service 42 42 43 43 You can query to find out whether a given request came through as one of these types with: 44 - request.post_format? (: query_string, :xml or :yaml)44 - request.post_format? (:url_encoded, :xml or :yaml) 45 45 - request.formatted_post? (for either xml or yaml) 46 46 - request.xml_post? trunk/actionpack/lib/action_controller/cgi_process.rb
r1305 r1336 64 64 65 65 def request_parameters 66 if env['HTTP_X_POST_DATA_FORMAT']67 CGIMethods.parse_formatted_request_parameters( env['HTTP_X_POST_DATA_FORMAT'].downcase.intern, env['RAW_POST_DATA'])66 if formatted_post? 67 CGIMethods.parse_formatted_request_parameters(post_format, env['RAW_POST_DATA']) 68 68 else 69 69 CGIMethods.parse_request_parameters(@cgi.params) trunk/actionpack/lib/action_controller/request.rb
r1325 r1336 4 4 # Returns both GET and POST parameters in a single hash. 5 5 def parameters 6 # puts "#{request_parameters.inspect} | #{query_parameters.inspect} | #{path_parameters.inspect}"7 6 @parameters ||= request_parameters.merge(query_parameters).merge(path_parameters).with_indifferent_access 8 7 end … … 37 36 env['HTTP_X_POST_DATA_FORMAT'].downcase.intern 38 37 else 39 :query_string 38 case env['HTTP_CONTENT_TYPE'] 39 when 'application/xml', 'text/xml' 40 :xml 41 when 'application/x-yaml', 'text/x-yaml' 42 :yaml 43 else 44 :url_encoded 45 end 40 46 end 41 47 end