Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I am receiving http requests to my rails application to a url /account/postback
The body of this incoming request contains some json that I need to retrieve, how can I do this in ruby?
The following should print the body of the request
routes.rb
map.connect 'account/:action', :controller => 'accounts'
accounts_controller.rb
class AccountsController < ApplicationController def postback puts request.body.read end end
Add a comment
If your HTTP call is using the POST verb you could alternatively use request.raw_post to retrieve the contents sent in the request's body.
request.raw_post
Hope it helps!