这是我的问题.. 资源:用户 方法:创建
我这样调用curl:
curl -X POST -H 'Content-type: text/xml' -d '<xml><login>john</login><password>123456</password></xml>' http://0.0.0.0:3000/users
但是 rails 中的参数散列看起来像这样:
{"xml"=> {"login"=>"luca", "password"=>"123456"}}
我希望它看起来像这样:
{"login"=>"luca", "password"=>"123456"}
如果我在 url 上传递参数 (...?login=luca&pas...),我可以让它变成那样,但这并不好...
有什么想法吗?
最佳答案
curl -X POST -d 'login=john&password=123456' http://0.0.0.0:3000/users
关于ruby-on-rails - 如何使用 curl 查询 restful rails 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1219338/