aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Helpers/ResponseExtensions.cs
blob: 86ac1c88d8ac532d03fed177798935c02ea78cbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
using Newtonsoft.Json;
using System.Net.Http;
using System.Threading.Tasks;

namespace Timeline.Tests.Helpers
{
    public static class ResponseExtensions
    {
        public static async Task<T> ReadBodyAsJson<T>(this HttpResponseMessage response)
        {
            return JsonConvert.DeserializeObject<T>(await response.Content.ReadAsStringAsync());
        }
    }
}