aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline.Tests/IntegratedTests/HttpResponseExtensions.cs
blob: 097fefd119d881051338a594170ef1329b5b53ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;

namespace Timeline.Tests.IntegratedTests
{
    public static class HttpResponseExtensions
    {
        public static async Task<T?> ReadBodyAsJsonAsync<T>(this HttpResponseMessage response)
        {
            return await response.Content.ReadFromJsonAsync<T>(CommonJsonSerializeOptions.Options);
        }
    }
}