29 lines
888 B
C#
29 lines
888 B
C#
using Microsoft.AspNetCore.Http;
|
|
|
|
namespace Falcon.Middleware.Test
|
|
{
|
|
/// <summary>
|
|
/// 测试中间件
|
|
/// </summary>
|
|
public class MiddlewareTest:MiddlewareBase
|
|
{
|
|
public MiddlewareTest(RequestDelegate next) : base(next) {
|
|
}
|
|
|
|
/// <summary>
|
|
/// 在调用next之后执行
|
|
/// </summary>
|
|
/// <param name="context">请求上下文</param>
|
|
public async override void InvokeNextAfter(HttpContext context) {
|
|
await context.Response.WriteAsync("\nInvokeNextAfter");
|
|
}
|
|
/// <summary>
|
|
/// 在调用next之前执行
|
|
/// </summary>
|
|
/// <param name="context">请求上下文</param>
|
|
public async override void InvokeNextBefore(HttpContext context) {
|
|
await context.Response.WriteAsync("InvokeNextBefore\n");
|
|
}
|
|
}
|
|
}
|