开发者

Display incoming xml request in Rails

开发者 https://www.devze.com 2023-02-05 02:59 出处:网络
Hey guys, Is there an easy way to display the complete xml request I\'m getting posted to one of my methods?

Hey guys, Is there an easy way to display the complete xml request I'm getting posted to one of my methods? Thanks a 开发者_如何转开发lot


If you want to see the actual XML that is being posted rather than a params hash try

xml_data = request.raw_post

Then to get a hash out of that you could do

hash_from_xml_data = Hash.from_xml(xml_data)


I'm inferring a bit, but you probably want request.body.

An easy, though slightly dirty, way to view it is to raise it as an error in your controller: raise request.body

0

精彩评论

暂无评论...
验证码 换一张
取 消