Rails: issuing POST and other HTTP requests from rails console?

Maybe a dumb question, but is there a way to send HTTP requests directly from the rails console? Those that are POST / GET / PUT / DELETE? Not having done the first routing first?

+8
ruby-on-rails console
source share
1 answer

You can use app.get and friends:

 app.get app.auctions_path # 200 app.post app.auctions_path # 200 

The app variable maps to ActionDispatch::Integration::Session , so all of its methods are available to you, including routes.

+12
source

All Articles