pompon_667
pompon_667

Reputation: 1

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

Upvotes: 0

Views: 600

Answers (2)

fflyer05
fflyer05

Reputation: 873

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)

Upvotes: 1

Andy Lindeman
Andy Lindeman

Reputation: 12165

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

Upvotes: 0

Related Questions