예제 #1
0
 public static IApplicationBuilder AddKoala(this IApplicationBuilder self, HttpHandler handler)
 {
     self.UseMiddleware <KoalaMiddleware>(handler);
     return(self);
 }
예제 #2
0
 public abstract HttpHandler WithNext(HttpHandler next);
예제 #3
0
 public KoalaMiddleware(RequestDelegate next, HttpHandler handler, ILoggerFactory loggerFactory)
 {
     _next          = next;
     _handler       = handler;
     _loggerFactory = loggerFactory;
 }
예제 #4
0
 public static HttpHandler Wrap(Func <HttpContext, HttpHandler> f)
 {
     return(HttpHandler.FromFunc(async ctx => await f(ctx).Invoke(ctx)));
 }
예제 #5
0
 public abstract Task <bool> Invoke(HttpHandler next, HttpContext ctx);
예제 #6
0
 public override HttpHandler WithNext(HttpHandler next)
 {
     return(HttpHandler.FromFunc(ctx => this.Invoke(next, ctx)));
 }
예제 #7
0
 public override Task <bool> Invoke(HttpHandler next, HttpContext ctx)
 {
     return(_f(next, ctx));
 }
예제 #8
0
 public static HttpHandler subRoute(string path, HttpHandler next)
 {
     return(routeStartsWith(path, handlerWithRootedPath(path).WithNext(next)));
 }
예제 #9
0
 public static HttpHandler routeStartsWith(string path, HttpHandler next)
 {
     return(routeStartsWith(path).WithNext(next));
 }
예제 #10
0
 public static HttpHandler GET(HttpHandler next)
 {
     return(GET().WithNext(next));
 }