using System.Threading.Tasks;
using GenHTTP.Api.Content;
using GenHTTP.Api.Protocol;
namespace Artemis.Core.Services;
///
/// Represents an GenHTTP handler used to process web requests and forward them to the right
/// .
///
public class StatusHandler : IHandler
{
///
public ValueTask PrepareAsync()
{
return ValueTask.CompletedTask;
}
///
public ValueTask HandleAsync(IRequest request)
{
// Used to be part of the RemoteController but moved here to avoid the /remote/ prefix enforced by GenHTTP
return request.Target.Current?.Value == "status"
? ValueTask.FromResult(request.Respond().Status(ResponseStatus.NoContent).Build())
: ValueTask.FromResult(null);
}
}