How can I get the response url or id from a rails project with httparty in a separate script after doing a post?
ruby script:
HTTParty.post('http://localhost:3000/change_logs', parameters)
response.body and all the others ones do not show the url and the response id
Two years later, I found a way to access the last URI from the request
attribute on the response
:
url = "http://example.com/redirects/to/www"
response = HTTParty.get(url)
response.request.last_uri.to_s
# => "http://www.example.com"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With