diff options
Diffstat (limited to 'Timeline.Tests/Helpers/HttpResponseExtensions.cs')
-rw-r--r-- | Timeline.Tests/Helpers/HttpResponseExtensions.cs | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/Timeline.Tests/Helpers/HttpResponseExtensions.cs b/Timeline.Tests/Helpers/HttpResponseExtensions.cs deleted file mode 100644 index 2bd497f1..00000000 --- a/Timeline.Tests/Helpers/HttpResponseExtensions.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Net.Http;
-using System.Text.Json;
-using System.Text.Json.Serialization;
-using System.Threading.Tasks;
-using Timeline.Models.Converters;
-using Timeline.Models.Http;
-
-namespace Timeline.Tests.Helpers
-{
- public static class HttpResponseExtensions
- {
- public static JsonSerializerOptions JsonSerializerOptions { get; }
-
- static HttpResponseExtensions()
- {
- JsonSerializerOptions = new JsonSerializerOptions
- {
- PropertyNamingPolicy = JsonNamingPolicy.CamelCase
- };
- JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
- JsonSerializerOptions.Converters.Add(new JsonDateTimeConverter());
- }
-
- public static async Task<T> ReadBodyAsJsonAsync<T>(this HttpResponseMessage response)
- {
- var stream = await response.Content.ReadAsStreamAsync();
- return await JsonSerializer.DeserializeAsync<T>(stream, JsonSerializerOptions);
- }
-
- public static Task<CommonResponse> ReadBodyAsCommonResponseAsync(this HttpResponseMessage response)
- {
- return response.ReadBodyAsJsonAsync<CommonResponse>();
- }
- }
-}
|