【发布时间】:2015-12-20 08:04:24
【问题描述】:
我正在尝试使用带有一些参数的 HTTParty 发送 HTTP 请求,
例如:
GET URL: http://example1.com?a=123&b=456
response_to_get = HTTParty.get('http://example1.com?a=123&b=456')
此特定请求的 redirect_url 是 http://example2.com
当我在浏览器中尝试 URL http://example1.com?a=123&b=456 时,它会重定向到预期的 URL,并像 http://example2.com?c=123trt58 一样附加参数值,但是当我使用 HTTParty 执行此操作时,我只得到一个 HTML 响应。
我的要求是从响应中获取 URL(http://example2.com?c=123trt58)。
提前致谢。
【问题讨论】:
标签: http ruby-on-rails-4 httparty ruby-2.2