diff --git a/Ombi.Api/ApiRequest.cs b/Ombi.Api/ApiRequest.cs index bb4dabb0a..c399eae45 100644 --- a/Ombi.Api/ApiRequest.cs +++ b/Ombi.Api/ApiRequest.cs @@ -59,17 +59,7 @@ namespace Ombi.Api var response = client.Execute(request); Log.Trace($"Request made to {response.ResponseUri} with status code {response.StatusCode}. The response was {response.Content}"); - /** - if (response.ErrorException != null) - { - var message = "Error retrieving response. Check inner details for more info."; - Log.Error(response.ErrorException); - Log.Error(response.ErrorException.InnerException); - throw new ApiRequestException(message, response.ErrorException); - } - **/ - - if (response.StatusCode == HttpStatusCode.OK) + if (response.StatusCode == HttpStatusCode.OK || response.StatusCode == HttpStatusCode.Created) return response.Data; else throw new ApiRequestException($"Got StatusCode={response.StatusCode} for {response.ResponseUri}."); @@ -89,17 +79,7 @@ namespace Ombi.Api var response = client.Execute(request); Log.Trace($"Request made to {response.ResponseUri} with status code {response.StatusCode}. The response was {response.Content}"); - /** - if (response.ErrorException != null) - { - Log.Error(response.ErrorException); - Log.Error(response.ErrorException.InnerException); - var message = "Error retrieving response. Check inner details for more info."; - throw new ApiRequestException(message, response.ErrorException); - } - **/ - - if (response.StatusCode == HttpStatusCode.OK) + if (response.StatusCode == HttpStatusCode.OK || response.StatusCode == HttpStatusCode.Created) return DeserializeXml(response.Content); else throw new ApiRequestException($"Got StatusCode={response.StatusCode} for {response.ResponseUri}."); @@ -112,17 +92,7 @@ namespace Ombi.Api var response = client.Execute(request); Log.Trace($"Request made to {response.ResponseUri} with status code {response.StatusCode}. The response was {response.Content}"); - /** - if (response.ErrorException != null) - { - Log.Error(response.ErrorException); - Log.Error(response.ErrorException.InnerException); - var message = "Error retrieving response. Check inner details for more info."; - throw new ApiRequestException(message, response.ErrorException); - } - **/ - - if (response.StatusCode == HttpStatusCode.OK) + if (response.StatusCode == HttpStatusCode.OK || response.StatusCode == HttpStatusCode.Created) return JsonConvert.DeserializeObject(response.Content, _settings); else throw new ApiRequestException($"Got StatusCode={response.StatusCode} for {response.ResponseUri}.");