From 4b95f9910cf34ec2312d40c87bbb9a6c33bfd123 Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Fri, 30 Jan 2026 00:44:39 -0500 Subject: [PATCH] Fix: Ensure POST requests always send body content to Jellyfin - Always send body content for POST requests, even if empty (send '{}') - Update TODO.md to mark tasks 2 and 3 as done - Improve logging for POST body debugging --- .../Services/Jellyfin/JellyfinProxyService.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/allstarr/Services/Jellyfin/JellyfinProxyService.cs b/allstarr/Services/Jellyfin/JellyfinProxyService.cs index 447ffdb..d866103 100644 --- a/allstarr/Services/Jellyfin/JellyfinProxyService.cs +++ b/allstarr/Services/Jellyfin/JellyfinProxyService.cs @@ -256,15 +256,14 @@ public class JellyfinProxyService using var request = new HttpRequestMessage(HttpMethod.Post, url); - // Create content from body string - if (!string.IsNullOrEmpty(body)) + // Create content from body string - ALWAYS set content even if empty + // Jellyfin expects a body for POST requests, even if it's "{}" + var bodyToSend = string.IsNullOrWhiteSpace(body) ? "{}" : body; + request.Content = new StringContent(bodyToSend, System.Text.Encoding.UTF8, "application/json"); + + if (string.IsNullOrWhiteSpace(body)) { - request.Content = new StringContent(body, System.Text.Encoding.UTF8, "application/json"); - _logger.LogDebug("POST body length: {Length} bytes", body.Length); - } - else - { - _logger.LogWarning("POST body is empty for {Url}", url); + _logger.LogWarning("POST body was empty for {Url}, sending empty JSON object", url); } bool authHeaderAdded = false; @@ -312,12 +311,12 @@ public class JellyfinProxyService } else { - _logger.LogInformation("POST to Jellyfin: {Url}, body length: {Length} bytes", url, body.Length); + _logger.LogInformation("POST to Jellyfin: {Url}, body length: {Length} bytes", url, bodyToSend.Length); // Log body content for playback endpoints to debug if (endpoint.Contains("Playing", StringComparison.OrdinalIgnoreCase)) { - _logger.LogInformation("Sending body to Jellyfin: {Body}", body); + _logger.LogInformation("Sending body to Jellyfin: {Body}", bodyToSend); } }