mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-28 04:51:45 +02: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:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user