diff options
Diffstat (limited to 'internal/api')
| -rw-r--r-- | internal/api/handlers_podcast.go | 4 | ||||
| -rw-r--r-- | internal/api/handlers_podcast_test.go | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/internal/api/handlers_podcast.go b/internal/api/handlers_podcast.go index 4568022..f93b15c 100644 --- a/internal/api/handlers_podcast.go +++ b/internal/api/handlers_podcast.go @@ -58,6 +58,10 @@ func (s *Server) handleSubscribePodcast(w http.ResponseWriter, r *http.Request) forbidden(w, "access denied") return } + if errors.Is(err, service.ErrInvalidFeed) { + badRequest(w, "invalid feed") + return + } s.logger.Error("subscribe podcast", "err", err) writeJSON(w, http.StatusInternalServerError, map[string]string{"error": "failed to subscribe"}) return diff --git a/internal/api/handlers_podcast_test.go b/internal/api/handlers_podcast_test.go index 33a129c..963c2a0 100644 --- a/internal/api/handlers_podcast_test.go +++ b/internal/api/handlers_podcast_test.go @@ -303,8 +303,8 @@ func TestPodcastE2E_FullFlow(t *testing.T) { rr := httptest.NewRecorder() srv.ServeHTTP(rr, req) - if rr.Code != http.StatusInternalServerError && rr.Code != http.StatusBadRequest { - t.Fatalf("expected 400 or 500, got %d", rr.Code) + if rr.Code != http.StatusBadRequest { + t.Fatalf("expected %d, got %d", http.StatusBadRequest, rr.Code) } }) |
