mirror of
https://github.com/sebastian-heinz/mhf-server.git
synced 2025-04-03 13:28:30 +08:00
29 lines
717 B
C#
29 lines
717 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Mhf.Server.Web.Middleware
|
|
{
|
|
/// <summary>
|
|
/// Implementation of a middleware
|
|
/// </summary>
|
|
public class WebMiddlewareStack
|
|
{
|
|
private WebMiddlewareDelegate _webMiddlewareDelegate;
|
|
|
|
public WebMiddlewareStack(WebMiddlewareDelegate kernel)
|
|
{
|
|
_webMiddlewareDelegate = kernel;
|
|
}
|
|
|
|
public Task<WebResponse> Start(WebRequest request)
|
|
{
|
|
return _webMiddlewareDelegate(request);
|
|
}
|
|
|
|
public void Use(Func<WebMiddlewareDelegate, WebMiddlewareDelegate> middleware)
|
|
{
|
|
_webMiddlewareDelegate = middleware(_webMiddlewareDelegate);
|
|
}
|
|
}
|
|
}
|