From ca1533f816483a8017d4fe9e327ef697beb1319b Mon Sep 17 00:00:00 2001 From: Mia Winter Date: Fri, 9 Feb 2024 11:51:49 +0100 Subject: [PATCH] fixed RSS endpoints returning json --- Wave/Controllers/RssController.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Wave/Controllers/RssController.cs b/Wave/Controllers/RssController.cs index 2342f8c..0f1bf86 100644 --- a/Wave/Controllers/RssController.cs +++ b/Wave/Controllers/RssController.cs @@ -14,23 +14,25 @@ public class RssController(IOptions customizations, ApplicationDb private IOptions Features { get; } = features; [HttpGet("rss.xml", Name = "RssFeed")] - [Produces("application/rss+xml", "application/json")] + [Produces("application/rss+xml")] [ResponseCache(Duration = 60*15, Location = ResponseCacheLocation.Any)] public async Task GetRssFeedAsync(string? category = null) { - if (!Features.Value.Rss) return Unauthorized("RSS is disabled"); + if (!Features.Value.Rss) return new JsonResult("RSS is disabled") {StatusCode = StatusCodes.Status401Unauthorized}; var feed = await CreateFeedAll("RssFeed", category); if (feed is null) return NotFound(); + Response.ContentType = "application/atom+xml"; return Ok(feed); } [HttpGet("atom.xml", Name = "AtomFeed")] - [Produces("application/atom+xml", "application/json")] + [Produces("application/atom+xml")] [ResponseCache(Duration = 60*15, Location = ResponseCacheLocation.Any)] public async Task GetAtomFeedAsync(string? category = null) { - if (!Features.Value.Rss) return Unauthorized("RSS is disabled"); + if (!Features.Value.Rss) return new JsonResult("RSS is disabled") {StatusCode = StatusCodes.Status401Unauthorized}; var feed = await CreateFeedAll("AtomFeed", category); if (feed is null) return NotFound(); + Response.ContentType = "application/atom+xml"; return Ok(feed); }