Fix redirect handling not working with HTTPoison
This commit is contained in:
parent
e10a614f3e
commit
0ded09a65d
|
@ -12,9 +12,9 @@ defmodule Frenzy.Network do
|
||||||
{:ok, %HTTPoison.Response{status_code: status_code, headers: headers}}
|
{:ok, %HTTPoison.Response{status_code: status_code, headers: headers}}
|
||||||
when status_code in @http_redirect_codes ->
|
when status_code in @http_redirect_codes ->
|
||||||
headers
|
headers
|
||||||
|> Enum.find(fn {name, _value} -> name == "location" end)
|
|> Enum.find(fn {name, _value} -> String.downcase(name) == "location" end)
|
||||||
|> case do
|
|> case do
|
||||||
{"location", new_url} ->
|
{_, new_url} ->
|
||||||
new_url =
|
new_url =
|
||||||
case URI.parse(new_url) do
|
case URI.parse(new_url) do
|
||||||
%URI{host: nil, path: path} ->
|
%URI{host: nil, path: path} ->
|
||||||
|
|
Loading…
Reference in New Issue