aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Helpers/ResponseExtensions.cs
blob: 9ca583fcd9a0c669349c19113a9c5a6ed09c76c4 (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());
        }
    }
}