mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Added support for POST data in form of YAML or XML, which is controller through the POST_DATA_MARSHAL header
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1304 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
db11abbfba
commit
86d2b2792a
2 changed files with 31 additions and 1 deletions
|
@ -1,5 +1,35 @@
|
|||
*SVN*
|
||||
|
||||
* Added support for POST data in form of YAML or XML, which is controller through the POST_DATA_MARSHAL header. Example request:
|
||||
|
||||
POST_DATA_MARSHAL: xml
|
||||
<request><item><content>HelloWorld</content></item></request>
|
||||
|
||||
...is the same as:
|
||||
|
||||
POST_DATA_MARSHAL: yaml
|
||||
---
|
||||
item:
|
||||
content: HelloWorld
|
||||
|
||||
...is the same as:
|
||||
|
||||
item[content]=HelloWorld
|
||||
|
||||
Which in the end turns into { "item" => { "content" => "HelloWorld" } }. This makes it a lot easier to publish REST web services on top of your regular actions (as they won't care).
|
||||
|
||||
Example Curl call:
|
||||
|
||||
curl -H 'POST_DATA_MARSHAL: xml' -d '<request><item><content>KillMeMore</content></item></request>' http://www.example.com/service
|
||||
|
||||
You can query to find out whether a given request came through as one of these types with:
|
||||
- request.post_format? (:query_string, :xml or :yaml)
|
||||
- request.formatted_post? (for either xml or yaml)
|
||||
- request.xml_post?
|
||||
- request.yaml_post?
|
||||
|
||||
* Added bundling of XmlSimple by Maik Schmidt
|
||||
|
||||
* Fixed that render_partial_collection should always return a string (and not sometimes an array, despite <%= %> not caring)
|
||||
|
||||
* Added TextHelper#sanitize that can will remove any Javascript handlers, blocks, and forms from an input of HTML. This allows for use of HTML on public sites, but still be free of XSS issues. #1277 [Jamis Buck]
|
||||
|
|
|
@ -218,7 +218,7 @@ module ActionView #:nodoc:
|
|||
if @@template_handlers[template_extension]
|
||||
"delegate_render"
|
||||
else
|
||||
(template_extension == "rxml" ? "rxml" : "rhtml") + "_render"
|
||||
(template_extension.to_s == "rxml" ? "rxml" : "rhtml") + "_render"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue