From bc32f849190a1aaeccd0addf1e325c2a85fc423d Mon Sep 17 00:00:00 2001 From: BlossomiShymae <87099578+BlossomiShymae@users.noreply.github.com> Date: Fri, 9 Aug 2024 18:13:14 -0500 Subject: [PATCH] Fix issues --- Needlework.Net.Desktop/ViewModels/ConsoleViewModel.cs | 10 +++++----- .../ViewModels/PathOperationViewModel.cs | 2 +- Needlework.Net.Desktop/Views/ConsoleView.axaml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Needlework.Net.Desktop/ViewModels/ConsoleViewModel.cs b/Needlework.Net.Desktop/ViewModels/ConsoleViewModel.cs index aec7d93..90eb2d4 100644 --- a/Needlework.Net.Desktop/ViewModels/ConsoleViewModel.cs +++ b/Needlework.Net.Desktop/ViewModels/ConsoleViewModel.cs @@ -26,7 +26,7 @@ namespace Needlework.Net.Desktop.ViewModels [ObservableProperty] private string? _requestBody = null; [ObservableProperty] private string? _responsePath = null; [ObservableProperty] private string? _responseStatus = null; - [ObservableProperty] private string? _responseAuthentication = null; + [ObservableProperty] private string? _responseAuthorization = null; public WindowService WindowService { get; } @@ -65,20 +65,20 @@ namespace Needlework.Net.Desktop.ViewModels var riotAuthentication = new RiotAuthentication(processInfo.RemotingAuthToken); var body = await response.Content.ReadAsStringAsync(); - body = JsonSerializer.Serialize(JsonSerializer.Deserialize(body, App.JsonSerializerOptions)); + body = !string.IsNullOrEmpty(body) ? JsonSerializer.Serialize(JsonSerializer.Deserialize(body), App.JsonSerializerOptions) : string.Empty; if (body.Length >= App.MaxCharacters) WindowService.ShowOopsiesWindow(body); else WeakReferenceMessenger.Default.Send(new ResponseUpdatedMessage(body), nameof(ConsoleViewModel)); - ResponseStatus = response.StatusCode.ToString(); + ResponseStatus = $"{(int)response.StatusCode} {response.StatusCode.ToString()}"; ResponsePath = $"https://127.0.0.1:{processInfo.AppPort}{RequestPath}"; - ResponseAuthentication = $"Basic {riotAuthentication.Value}"; + ResponseAuthorization = $"Basic {riotAuthentication.Value}"; } catch (Exception ex) { await SukiHost.ShowToast("Request Failed", ex.Message, SukiUI.Enums.NotificationType.Error); ResponseStatus = null; ResponsePath = null; - ResponseAuthentication = null; + ResponseAuthorization = null; WeakReferenceMessenger.Default.Send(new ResponseUpdatedMessage(string.Empty), nameof(ConsoleViewModel)); } finally diff --git a/Needlework.Net.Desktop/ViewModels/PathOperationViewModel.cs b/Needlework.Net.Desktop/ViewModels/PathOperationViewModel.cs index 0d113e9..9ef3922 100644 --- a/Needlework.Net.Desktop/ViewModels/PathOperationViewModel.cs +++ b/Needlework.Net.Desktop/ViewModels/PathOperationViewModel.cs @@ -98,7 +98,7 @@ namespace Needlework.Net.Desktop.ViewModels var riotAuthentication = new RiotAuthentication(processInfo.RemotingAuthToken); var responseBody = await response.Content.ReadAsStringAsync(); - responseBody = JsonSerializer.Serialize(JsonSerializer.Deserialize(responseBody, App.JsonSerializerOptions)); + responseBody = !string.IsNullOrEmpty(responseBody) ? JsonSerializer.Serialize(JsonSerializer.Deserialize(responseBody), App.JsonSerializerOptions) : string.Empty; if (responseBody.Length >= App.MaxCharacters) WeakReferenceMessenger.Default.Send(new OopsiesWindowRequestedMessage(responseBody)); else WeakReferenceMessenger.Default.Send(new EditorUpdateMessage(new(responseBody, "EndpointResponseEditor"))); diff --git a/Needlework.Net.Desktop/Views/ConsoleView.axaml b/Needlework.Net.Desktop/Views/ConsoleView.axaml index 877a15d..e34040a 100644 --- a/Needlework.Net.Desktop/Views/ConsoleView.axaml +++ b/Needlework.Net.Desktop/Views/ConsoleView.axaml @@ -64,7 +64,7 @@ - +