Follow redirects.
I think we should be using some global adapter options here, though.
This commit is contained in:
parent
697bea0473
commit
157ecf4022
|
@ -50,7 +50,9 @@ def preview(conn, %{"sig" => sig64, "url" => url64}) do
|
||||||
|
|
||||||
defp handle_preview(conn, url) do
|
defp handle_preview(conn, url) do
|
||||||
with {:ok, %{status: status} = head_response} when status in 200..299 <-
|
with {:ok, %{status: status} = head_response} when status in 200..299 <-
|
||||||
Tesla.head(url, opts: [adapter: [timeout: preview_head_request_timeout()]]) do
|
Tesla.head(url,
|
||||||
|
opts: [adapter: [timeout: preview_head_request_timeout(), follow_redirect: true]]
|
||||||
|
) do
|
||||||
content_type = Tesla.get_header(head_response, "content-type")
|
content_type = Tesla.get_header(head_response, "content-type")
|
||||||
handle_preview(content_type, conn, url)
|
handle_preview(content_type, conn, url)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue