From dfbcff5d470dac4ca8ef6faba796d66e7f6e9dd0 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Thu, 18 Jul 2024 21:29:36 +0200 Subject: [PATCH] Fixed error messages for requests with no response --- Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs index 5536cdd9c..afdae1941 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs @@ -338,6 +338,9 @@ namespace Duplicati.GUI.TrayIcon var response = await HTTPCLIENT.SendAsync(request, cts.Token); response.EnsureSuccessStatusCode(); + if (typeof(T) == typeof(string)) + return (T)(object)await response.Content.ReadAsStringAsync(); + using (var stream = await response.Content.ReadAsStreamAsync()) return await JsonSerializer.DeserializeAsync(stream, serializerOptions); }