mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
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
This commit is contained in:
@@ -256,15 +256,14 @@ public class JellyfinProxyService
|
|||||||
|
|
||||||
using var request = new HttpRequestMessage(HttpMethod.Post, url);
|
using var request = new HttpRequestMessage(HttpMethod.Post, url);
|
||||||
|
|
||||||
// Create content from body string
|
// Create content from body string - ALWAYS set content even if empty
|
||||||
if (!string.IsNullOrEmpty(body))
|
// 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.LogWarning("POST body was empty for {Url}, sending empty JSON object", url);
|
||||||
_logger.LogDebug("POST body length: {Length} bytes", body.Length);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.LogWarning("POST body is empty for {Url}", url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool authHeaderAdded = false;
|
bool authHeaderAdded = false;
|
||||||
@@ -312,12 +311,12 @@ public class JellyfinProxyService
|
|||||||
}
|
}
|
||||||
else
|
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
|
// Log body content for playback endpoints to debug
|
||||||
if (endpoint.Contains("Playing", StringComparison.OrdinalIgnoreCase))
|
if (endpoint.Contains("Playing", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Sending body to Jellyfin: {Body}", body);
|
_logger.LogInformation("Sending body to Jellyfin: {Body}", bodyToSend);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user