Method: Dogapi::APIService#handle_redirect

Defined in:
lib/dogapi/common.rb

#handle_redirect(conn, req, resp, retries = 10) ⇒ Object



198
199
200
201
202
203
204
205
# File 'lib/dogapi/common.rb', line 198

def handle_redirect(conn, req, resp, retries=10)
  req.uri = URI.parse(resp.header['location'])
  new_response = conn.request(req)
  if retries > 1 && new_response.code.to_i / 100 == 3
    new_response = handle_redirect(conn, req, new_response, retries - 1)
  end
  new_response
end