Compare commits

..

1 Commits

Author SHA1 Message Date
Shadowfacts 4ef8423ccd
Handle feed URL redirects
Closes #1
2019-06-30 21:46:45 -04:00
1 changed files with 2 additions and 1 deletions

View File

@ -74,7 +74,8 @@ defmodule Frenzy.UpdateFeeds do
{:ok, %HTTPoison.Response{status_code: 404}} ->
Logger.warn("RSS feed #{feed.feed_url} not found")
{:ok, %HTTPoison.Response{status_code: status_code}} when status_code in [301, 302] ->
{:ok, %HTTPoison.Response{status_code: status_code, headers: headers}}
when status_code in [301, 302] ->
{"Location", new_url} =
Enum.find(headers, fn {name, _value} ->
name == "Location"