mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-10 23:33:38 -07:00
Fixed: Re-Clean Release Endpoints, we have ReadResourceFromRequest!
This commit is contained in:
parent
f0365eaaa7
commit
7bd96ae75c
3 changed files with 24 additions and 53 deletions
|
@ -5,6 +5,7 @@ using FluentValidation;
|
|||
using Nancy;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Lidarr.Http.REST
|
||||
{
|
||||
|
@ -194,8 +195,16 @@ namespace Lidarr.Http.REST
|
|||
|
||||
protected TResource ReadResourceFromRequest(bool skipValidate = false)
|
||||
{
|
||||
//TODO: handle when request is null
|
||||
var resource = Request.Body.FromJson<TResource>();
|
||||
var resource = new TResource();
|
||||
|
||||
try
|
||||
{
|
||||
resource = Request.Body.FromJson<TResource>();
|
||||
}
|
||||
catch (JsonReaderException ex)
|
||||
{
|
||||
throw new BadRequestException(ex.Message);
|
||||
}
|
||||
|
||||
if (resource == null)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue