I am creating a RESTful web service and want to allow the user to
supply the POST/PUT representation as either url-encoded key/value
pairs or XML. I have read in several sources that Rails will parse
incoming XML into the params hash. The following data should be
equivalent:
XML: Hello
url-encoded: product[test]=Hello
They should both result in the hash params = {“product” => {“test” =>
“Hello”}} (+ format, controller and action keys)
But when I do the following curl command:
curl -u name:pass -i -X POST -d “Hej” http://localhost:3003/product.xml
the params hash looks like this:
{"<dt_order>Hej</dt_order>"=>""}
Does anyone have any input on why this happens and how to solve it. I
am running 1.2.6 and a 2.0 migration is not possible since the
application is in production.
Thanks in advance
Erik L.