chore: initial commit
This commit is contained in:
17
src/Extensions/HttpResponseMessageExtensions.cs
Normal file
17
src/Extensions/HttpResponseMessageExtensions.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Novaloop.PaymoApi.Exceptions;
|
||||
|
||||
namespace Novaloop.PaymoApi.Extensions
|
||||
{
|
||||
internal static class HttpResponseMessageExtensions
|
||||
{
|
||||
internal static async Task ThrowExceptionWithDetailsIfUnsuccessful(this HttpResponseMessage response)
|
||||
{
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
throw new PaymoApiException((int) response.StatusCode, await response.Content.ReadAsStringAsync());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user