简体   繁体   English

如何从响应中获取 cookie 并将其设置在 Rails 上 Ruby 中的下一个请求中,同时击中第 3 方 URL

[英]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.我正在研究 Postman。

But now I want to hit an URL, get the response along with cookies and set it, to send it to consecutive URLs.但现在我想打一个 URL,与 cookies 一起获得响应并设置它,将其发送到连续的 URL。

How to do this in Ruby Rails?如何在 Ruby Rails 中执行此操作?

You can use libraries like Faraday ( https://github.com/lostisland/faraday ) or httparty ( https://github.com/jnunemaker/httparty ) to achieve what you want.您可以使用 Faraday ( https://github.com/lostisland/faraday ) 或 httparty ( https://github.com/jnunemaker/httparty ) 等库来实现您想要的。 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还有一个内置在 ruby 语言net/http https://ruby-doc.org/stdlib-3.1.0/libdoc/net/http/rdoc/Net/HTTP.ZFC35FDC70D5FC69D26EZ83A8的库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM