Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails how to follow redirect in HTTParty GET request

I am using httparty to send a get request and then trying to follow the redirect:

get 'https://accounts.google.com/o/oauth2/auth'

how can i follow the redirect using HTTParty?

sorry if this have been asked before, but i could not find the answer anywhere.

Thanks

like image 663
Wahtever Avatar asked Apr 18 '13 14:04

Wahtever


1 Answers

Probably it's not needed now, but for someone who need.

From documentation, there is special option for automatically redirects

follow_redirects(value = true) ⇒ Object

Proceed to the location header when an HTTP response dictates a redirect. Redirects are always followed by default.

So you can use this options like that:

HTTParty.get('http://google.com', follow_redirects: true)
like image 85
Farkhat Mikhalko Avatar answered Oct 13 '22 05:10

Farkhat Mikhalko