mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Needed to treat a 201 as success, too. + removed some commented out code.
This commit is contained in:
parent
f400412568
commit
e46b621a2d
1 changed files with 3 additions and 33 deletions
|
@ -59,17 +59,7 @@ namespace Ombi.Api
|
|||
var response = client.Execute<T>(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<T>(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<T>(response.Content, _settings);
|
||||
else
|
||||
throw new ApiRequestException($"Got StatusCode={response.StatusCode} for {response.ResponseUri}.");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue