Exemplo n.º 1
0
 private static Action <IApplicationBuilder> Configure(AllStreamResource allStream)
 => builder => builder
 .UseMiddlewareLogging(typeof(AllStreamMiddleware))
 .MapWhen(
     HttpMethod.Get,
     inner => inner.UseAccept(Constants.MediaTypes.HalJson).Use(GetStream(allStream)))
 .UseAllowedMethods(allStream);
Exemplo n.º 2
0
        private static MidFunc GetStream(AllStreamResource allStream) => async(context, next) =>
        {
            var operation = new ReadAllStreamOperation(context.Request);

            var response = await allStream.Get(operation, context.RequestAborted);

            await context.WriteResponse(response);
        };
Exemplo n.º 3
0
 public static IApplicationBuilder UseAllStream(
     this IApplicationBuilder app,
     AllStreamResource allStream) => app
 .UseMiddlewareLogging(typeof(AllStreamMiddleware))
 .MapWhen(
     HttpMethod.Get,
     inner => inner.UseAccept(Constants.MediaTypes.HalJson).Use(GetStream(allStream)))
 .UseAllowedMethods(allStream);
Exemplo n.º 4
0
 public static IApplicationBuilder UseAllStream(
     this IApplicationBuilder builder,
     AllStreamResource allStream)
 => builder.MapWhen(IsMatch, Configure(allStream));