chore: re-adding 'Paymo' prefix in front of all classes

This commit is contained in:
Matthias Langhard
2021-12-17 15:26:09 +01:00
parent 1f6fc0a769
commit 160600c3d8
29 changed files with 269 additions and 269 deletions

View File

@@ -0,0 +1,45 @@
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
namespace Novaloop.PaymoApi.Shared
{
public class PaymoLoggingHandler : DelegatingHandler
{
private readonly ILogger<PaymoLoggingHandler> _logger;
public PaymoLoggingHandler(ILogger<PaymoLoggingHandler> logger)
{
_logger = logger;
}
public PaymoLoggingHandler(HttpMessageHandler innerHandler, ILogger<PaymoLoggingHandler> logger)
: base(innerHandler)
{
_logger = logger;
}
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
_logger.LogDebug($"Request:\n{request}");
if (request.Content != null)
{
var body = await request.Content.ReadAsStringAsync();
_logger.LogDebug(body);
}
var response = await base.SendAsync(request, cancellationToken);
_logger.LogDebug($"Response:\n{response}");
if (response.Content != null)
{
var body = await response.Content.ReadAsStringAsync();
_logger.LogDebug(body);
}
return response;
}
}
}