Follow redirects.

I think we should be using some global adapter options here, though.
This commit is contained in:
Mark Felder 2020-08-27 11:46:56 -05:00
parent 697bea0473
commit 157ecf4022

View file

@ -50,7 +50,9 @@ def preview(conn, %{"sig" => sig64, "url" => url64}) do
defp handle_preview(conn, url) do
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")
handle_preview(content_type, conn, url)
else