using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiveForum.Code.Utility;
///
///
///
public static class HttpRequestMessageExtensions
{
public static async Task ToJsonAsync(this HttpRequestMessage request)
{
var requestInfo = new
{
Method = request.Method.Method,
Url = request.RequestUri?.ToString(),
Headers = request.Headers,
Content = request.Content != null ? await request.Content.ReadAsStringAsync() : null
};
return JsonConvert.SerializeObject(requestInfo, Formatting.None);
}
}