简体   繁体   中英

Display incoming xml request in Rails

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM