From c00a0d1f2f50764d7c1f002127a0ca09b6c93478 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Fri, 13 Oct 2017 23:28:00 +0100 Subject: [PATCH] fixed #1570 #1571 --- src/Ombi.Api/Api.cs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Ombi.Api/Api.cs b/src/Ombi.Api/Api.cs index c1466b7b7..a674db290 100644 --- a/src/Ombi.Api/Api.cs +++ b/src/Ombi.Api/Api.cs @@ -13,15 +13,19 @@ namespace Ombi.Api public Api(ILogger log) { Logger = log; - _handler = new HttpClientHandler + } + + private ILogger Logger { get; } + + + private HttpMessageHandler GetHandler() + { + return new HttpClientHandler { ServerCertificateCustomValidationCallback = (message, certificate2, arg3, arg4) => true }; } - private ILogger Logger { get; } - private readonly HttpMessageHandler _handler; - private static readonly JsonSerializerSettings Settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore @@ -29,9 +33,9 @@ namespace Ombi.Api public async Task Request(Request request) { - using (var httpClient = new HttpClient(_handler)) + using (var httpClient = new HttpClient(GetHandler())) { - + using (var httpRequestMessage = new HttpRequestMessage(request.HttpMethod, request.FullUri)) { // Add the Json Body @@ -75,7 +79,7 @@ namespace Ombi.Api public async Task RequestContent(Request request) { - using (var httpClient = new HttpClient(_handler)) + using (var httpClient = new HttpClient(GetHandler())) { using (var httpRequestMessage = new HttpRequestMessage(request.HttpMethod, request.FullUri)) { @@ -109,7 +113,7 @@ namespace Ombi.Api public async Task Request(Request request) { - using (var httpClient = new HttpClient(_handler)) + using (var httpClient = new HttpClient(GetHandler())) { using (var httpRequestMessage = new HttpRequestMessage(request.HttpMethod, request.FullUri)) {