'How to get cookie from a response and set it on next request in Ruby on Rails while hitting 3rd party URL

I was working on Postman.

But now I want to hit an URL, get the response along with cookies and set it, to send it to consecutive URLs.

How to do this in Ruby Rails?



Solution 1:[1]

You can use libraries like Faraday (https://github.com/lostisland/faraday) or httparty (https://github.com/jnunemaker/httparty) to achieve what you want. There is also a library built in ruby language net/http https://ruby-doc.org/stdlib-3.1.0/libdoc/net/http/rdoc/Net/HTTP.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 stolarz