add missing changes/feedback

This commit is contained in:
AoshiW
2024-08-16 21:14:57 +02:00
parent af47e7c763
commit 0ca7f7869d
2 changed files with 5 additions and 12 deletions

View File

@@ -61,16 +61,9 @@ namespace Needlework.Net.Desktop.ViewModels
var content = new StringContent(requestBody, new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"));
var response = await Connector.SendAsync(method, RequestPath, content);
var riotAuthentication = new RiotAuthentication(processInfo.RemotingAuthToken);
var responseBody =
#if DEBUG
await response.Content.ReadAsStringAsync();
#else
await response.Content.ReadAsByteArrayAsync();
#endif
var responseBody = await response.Content.ReadAsByteArrayAsync();
var body = responseBody.Length > 0
? JsonSerializer.Serialize(JsonSerializer.Deserialize<object>(responseBody), App.JsonSerializerOptions)
: string.Empty;
var body = responseBody.Length > 0 ? JsonSerializer.Serialize(JsonSerializer.Deserialize<object>(responseBody), App.JsonSerializerOptions) : string.Empty;
if (body.Length >= App.MaxCharacters)
{
WindowService.ShowOopsiesWindow(body);

View File

@@ -99,11 +99,11 @@ namespace Needlework.Net.Desktop.ViewModels
var requestBody = WeakReferenceMessenger.Default.Send(new ContentRequestMessage(), "EndpointRequestEditor").Response;
var content = new StringContent(requestBody, new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"));
var response = await Connector.SendAsync(method, uri, content) ?? throw new Exception("Response is null.");
var response = await Connector.SendAsync(method, uri, content);
var riotAuthentication = new RiotAuthentication(processInfo.RemotingAuthToken);
var responseBody = await response.Content.ReadAsStringAsync();
var responseBytes = await response.Content.ReadAsByteArrayAsync();
responseBody = !string.IsNullOrEmpty(responseBody) ? JsonSerializer.Serialize(JsonSerializer.Deserialize<object>(responseBody), App.JsonSerializerOptions) : string.Empty;
var responseBody = responseBytes.Length > 0 ? JsonSerializer.Serialize(JsonSerializer.Deserialize<object>(responseBody), App.JsonSerializerOptions) : string.Empty;
if (responseBody.Length >= App.MaxCharacters)
{
WeakReferenceMessenger.Default.Send(new OopsiesWindowRequestedMessage(responseBody));