using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace SampleDestination
{
public class StatusMiddleware
{
///
/// Instantiates a new .
///
/// The next middleware in the pipeline.
public StatusMiddleware(RequestDelegate next)
{
}
///
/// Writes the status of the request sent in response. Does not invoke later middleware in the pipeline.
///
/// The of the current request.
/// A that completes when writing to the response is done.
public Task Invoke(HttpContext context)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
return context.Response.WriteAsync(context.Response.StatusCode.ToString());
}
}
}