Skip to content

Commit

Permalink
[r naming
Browse files Browse the repository at this point in the history
  • Loading branch information
i4004 committed Apr 6, 2024
1 parent 7cd772d commit c84fb37
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/Simplify.Web/ApplicationBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ public static IApplicationBuilder UseSimplifyWebNonTerminalWithoutRegistrations(
private static void RegisterAsNonTerminal(this IApplicationBuilder builder) =>
builder.Use(async (context, next) =>
{
await SimplifyWebRequestMiddleware.InvokeAsNonTerminal(context);
await SimplifyWebRequestMiddleware.InvokeAsNonTerminalAsync(context);

if (context.Response.StatusCode == (int)HttpStatusCode.NotFound)
await next.Invoke();
});

private static void RegisterAsTerminal(this IApplicationBuilder builder) => builder.Run(SimplifyWebRequestMiddleware.InvokeAsTerminal);
private static void RegisterAsTerminal(this IApplicationBuilder builder) => builder.Run(SimplifyWebRequestMiddleware.InvokeAsTerminalAsync);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Simplify.Web.Core2.RequestHandling.Handlers;

public class PageRenderingHandler(IPageRenderer renderer) : IRequestHandler

Check warning on line 7 in src/Simplify.Web/Core2/RequestHandling/Handlers/PageRenderingHandler.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Missing XML comment for publicly visible type or member 'PageRenderingHandler'

Check warning on line 7 in src/Simplify.Web/Core2/RequestHandling/Handlers/PageRenderingHandler.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Missing XML comment for publicly visible type or member 'PageRenderingHandler.PageRenderingHandler(IPageRenderer)'

Check warning on line 7 in src/Simplify.Web/Core2/RequestHandling/Handlers/PageRenderingHandler.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Missing XML comment for publicly visible type or member 'PageRenderingHandler'

Check warning on line 7 in src/Simplify.Web/Core2/RequestHandling/Handlers/PageRenderingHandler.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Missing XML comment for publicly visible type or member 'PageRenderingHandler.PageRenderingHandler(IPageRenderer)'
{
public async Task Execute(IHttpContext context, RequestHandler next)
public async Task ExecuteAsync(IHttpContext context, RequestHandler next)

Check warning on line 9 in src/Simplify.Web/Core2/RequestHandling/Handlers/PageRenderingHandler.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Missing XML comment for publicly visible type or member 'PageRenderingHandler.ExecuteAsync(IHttpContext, RequestHandler)'

Check warning on line 9 in src/Simplify.Web/Core2/RequestHandling/Handlers/PageRenderingHandler.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Missing XML comment for publicly visible type or member 'PageRenderingHandler.ExecuteAsync(IHttpContext, RequestHandler)'
{
await renderer.Render(context);
await next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ namespace Simplify.Web.Core2.RequestHandling.Handlers;

public class StaticFilesHandler(IStaticFileRequestHandler handler) : IRequestHandler
{
public async Task Execute(IHttpContext context, RequestHandler next)
public async Task ExecuteAsync(IHttpContext context, RequestHandler next)
{
if (handler.IsStaticFileRoutePath(context))
await handler.Execute(context);
await handler.ExecuteAsync(context);
else
await next();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Simplify.Web/Core2/RequestHandling/IRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ namespace Simplify.Web.Core2.RequestHandling;

public interface IRequestHandler
{
Task Execute(IHttpContext context, RequestHandler next);
Task ExecuteAsync(IHttpContext context, RequestHandler next);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ namespace Simplify.Web.Core2.RequestHandling;

public interface IRequestHandlingPipeline
{
Task Execute(IHttpContext context);
Task ExecuteAsync(IHttpContext context);
}
4 changes: 2 additions & 2 deletions src/Simplify.Web/Core2/ScopeRequestProcessExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public static class ScopeRequestProcessExtensions
/// </summary>
/// <param name="scope">The scope.</param>
/// <param name="context">The context.</param>
public static Task ProcessRequest(this ILifetimeScope scope, IHttpContext context) =>
scope.Resolver.Resolve<IRequestHandlingPipeline>().Execute(context);
public static Task ProcessRequestAsync(this ILifetimeScope scope, IHttpContext context) =>
scope.Resolver.Resolve<IRequestHandlingPipeline>().ExecuteAsync(context);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ public interface IStaticFileRequestHandler
/// </summary>
/// <param name="context">The context.</param>
/// <returns></returns>
Task Execute(IHttpContext context);
Task ExecuteAsync(IHttpContext context);
}
12 changes: 6 additions & 6 deletions src/Simplify.Web/Middleware/SimplifyWebRequestMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ public static class SimplifyWebRequestMiddleware
/// </summary>
public static event TraceEventHandler? OnTrace;

public static Task InvokeAsTerminal(HttpContext context) => Invoke(context, true);
public static Task InvokeAsTerminalAsync(HttpContext context) => InvokeAsync(context, true);

public static Task InvokeAsNonTerminal(HttpContext context) => Invoke(context, false);
public static Task InvokeAsNonTerminalAsync(HttpContext context) => InvokeAsync(context, false);

/// <summary>
/// Process an individual request.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="isTerminalMiddleware">if set to <c>true</c> [is terminal middleware].</param>
public static async Task Invoke(HttpContext context, bool isTerminalMiddleware)
public static async Task InvokeAsync(HttpContext context, bool isTerminalMiddleware)
{
using var scope = BootstrapperFactory.ContainerProvider.BeginLifetimeScope();

Expand All @@ -47,7 +47,7 @@ public static async Task Invoke(HttpContext context, bool isTerminalMiddleware)
await scope.StartMeasurements()
.Trace(context, OnTrace)
.SetupProviders(localContext)
.ProcessRequest(localContext);
.ProcessRequestAsync(localContext);
}
catch (Exception e)
{
Expand All @@ -62,7 +62,7 @@ await scope.StartMeasurements()
e = exception;
}

await context.WriteErrorResponse(scope, e);
await context.WriteErrorResponseAsync(scope, e);
}
}

Expand All @@ -76,7 +76,7 @@ internal static bool ProcessOnException(Exception e)
return true;
}

private static async Task WriteErrorResponse(this HttpContext context, ILifetimeScope scope, Exception e)
private static async Task WriteErrorResponseAsync(this HttpContext context, ILifetimeScope scope, Exception e)
{
var webContext = scope.Resolver.Resolve<IWebContextProvider>().Get();

Expand Down

0 comments on commit c84fb37

Please sign in to comment.