新手问题 RestClient 发送请求,遭遇 302 跳转如何解决?

chancedoor · May 15, 2013 · Last by yesmeck replied at May 15, 2013 · 6807 hits

我要发送请求到一个网站,它接到请求后跳转到一个页面,这个页面里包含我需要的结果,现在response=RestClient.post url, post_params , headers会 302 Found 咋搞?

https://github.com/rest-client/rest-client#result-handling

RestClient.post(url) { |response, request, result, &block|
  if [301, 302].include? response.code
    response.follow_redirection(request, result, &block)
  else
    response.return!(request, result, &block)
  end
}
huacnlee in [Topic was deleted] mention this topic. 27 Jul 16:17
You need to Sign in before reply, if you don't have an account, please Sign up first.