From e7f7f39ce851c3a243f0f92ed4526c2320049284 Mon Sep 17 00:00:00 2001 From: wint3rmute Date: Thu, 20 Jul 2023 19:40:43 +0200 Subject: [PATCH] Return empty response on /api/v1/metrics endpoint if metrics are not enabled --- src/invidious/routing.cr | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/invidious/routing.cr b/src/invidious/routing.cr index 27c3d199..5ee5ed58 100644 --- a/src/invidious/routing.cr +++ b/src/invidious/routing.cr @@ -312,6 +312,10 @@ module Invidious::Routing get "/api/v1/stats", {{namespace}}::Misc, :stats if CONFIG.statistics_enabled get "/api/v1/metrics", {{namespace}}::Misc, :metrics + else + get "/api/v1/metrics" do |env| + env.response.status_code = 204 + end end get "/api/v1/playlists/:plid", {{namespace}}::Misc, :get_playlist get "/api/v1/auth/playlists/:plid", {{namespace}}::Misc, :get_playlist