2019-12-11 13:58:31 +08:00
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
|
|
|
|
|
namespace Falcon.Middleware.Test
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 测试中间件
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class MiddlewareTest:MiddlewareBase
|
|
|
|
|
{
|
|
|
|
|
public MiddlewareTest(RequestDelegate next) : base(next) {
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-11 14:20:31 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 在调用next之后执行
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="context">请求上下文</param>
|
2019-12-11 13:58:31 +08:00
|
|
|
|
public async override void InvokeNextAfter(HttpContext context) {
|
|
|
|
|
await context.Response.WriteAsync("\nInvokeNextAfter");
|
|
|
|
|
}
|
2019-12-11 14:20:31 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 在调用next之前执行
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="context">请求上下文</param>
|
2019-12-11 13:58:31 +08:00
|
|
|
|
public async override void InvokeNextBefore(HttpContext context) {
|
|
|
|
|
await context.Response.WriteAsync("InvokeNextBefore\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|