forked from sim0n00ps/OF-DL
Debug logging in BuildHeaderAndExecuteRequests
This commit is contained in:
parent
3d4dfbae17
commit
d3b8ca6fcd
@ -14,6 +14,7 @@ using OF_DL.Enumerations;
|
||||
using OF_DL.Enumurations;
|
||||
using Serilog;
|
||||
using Spectre.Console;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
@ -129,7 +130,14 @@ public class APIHelper : IAPIHelper
|
||||
try
|
||||
{
|
||||
HttpRequestMessage request = await BuildHttpRequestMessage(getParams, endpoint, method);
|
||||
|
||||
Debug.WriteLine($"Executing {request.Method.Method.ToUpper()} request: {request.RequestUri}\r\n\t{GetParamsString(getParams)}");
|
||||
|
||||
using var response = await client.SendAsync(request);
|
||||
|
||||
if (Debugger.IsAttached && !response.IsSuccessStatusCode)
|
||||
Debugger.Break();
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
string body = await response.Content.ReadAsStringAsync();
|
||||
|
||||
@ -147,6 +155,9 @@ public class APIHelper : IAPIHelper
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
static string GetParamsString(Dictionary<string, string> getParams)
|
||||
=> string.Join(" | ", getParams.Select(kv => $"{kv.Key}={kv.Value}"));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user