mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
Added more magic to fancy. it now automatically figures our response for PUT and POST based on request ID.
file name sample uses HTTP GET instead of post
This commit is contained in:
parent
438e3199de
commit
4188946395
20 changed files with 135 additions and 198 deletions
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using NzbDrone.Common.Composition;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
@ -16,10 +17,11 @@ namespace NzbDrone.Api.Commands
|
|||
_messageAggregator = messageAggregator;
|
||||
_container = container;
|
||||
|
||||
CreateResource = RunCommand;
|
||||
Post["/"] = x => RunCommand(ReadResourceFromRequest());
|
||||
|
||||
}
|
||||
|
||||
private CommandResource RunCommand(CommandResource resource)
|
||||
private Response RunCommand(CommandResource resource)
|
||||
{
|
||||
var commandType =
|
||||
_container.GetImplementations(typeof(ICommand))
|
||||
|
@ -29,7 +31,7 @@ namespace NzbDrone.Api.Commands
|
|||
dynamic command = Request.Body.FromJson(commandType);
|
||||
_messageAggregator.PublishCommand(command);
|
||||
|
||||
return resource;
|
||||
return resource.AsResponse();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue