From 112a553d31d038e0c1faedb5513a5397badb189d Mon Sep 17 00:00:00 2001 From: Max Park Date: Mon, 13 Nov 2017 18:03:37 -0500 Subject: [PATCH] 301, 302, 303 (only POST), 307 redirections need at least one retry for hackney to follow it. --- lib/hound/session.ex | 4 ++-- notes/configuring-hound.md | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/hound/session.ex b/lib/hound/session.ex index 7bf24fe..f76cc21 100644 --- a/lib/hound/session.ex +++ b/lib/hound/session.ex @@ -25,8 +25,8 @@ defmodule Hound.Session do desiredCapabilities: capabilities } - # No retries for this request - make_req(:post, "session", params) + # 301, 302, 303 (only POST), 307 redirections need at least one retry for hackney to follow it. + make_req(:post, "session", params, %{}, 1) end @doc "Make capabilities for session" diff --git a/notes/configuring-hound.md b/notes/configuring-hound.md index fc804a9..4536ffb 100644 --- a/notes/configuring-hound.md +++ b/notes/configuring-hound.md @@ -52,6 +52,11 @@ config :hound, retry_time: 500 config :hound, http: [recv_timeout: :infinity, proxy: ["socks5", "127.0.0.1", "9050"]] ``` +```elixir +# Needed to follow 301, 302, 303 (only POST), 307 redirections +config :hound, http: [follow_redirect: true] +``` + ```elixir # Define selenium hub settings config :hound,