Skip to content

Commit

Permalink
Use IMiddleware interface
Browse files Browse the repository at this point in the history
  • Loading branch information
RehanSaeed committed Oct 12, 2018
1 parent 5546cbe commit eacb408
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
10 changes: 3 additions & 7 deletions Source/Boxed.AspNetCore/Middleware/HttpExceptionMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@ namespace Boxed.AspNetCore.Middleware
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

internal class HttpExceptionMiddleware
internal class HttpExceptionMiddleware : IMiddleware
{
private readonly RequestDelegate next;

public HttpExceptionMiddleware(RequestDelegate next) => this.next = next;

public async Task Invoke(HttpContext context)
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{
try
{
await this.next.Invoke(context).ConfigureAwait(false);
await next.Invoke(context).ConfigureAwait(false);
}
catch (HttpException httpException)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@ namespace Boxed.AspNetCore.Middleware
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

internal class InternalServerErrorOnExceptionMiddleware
internal class InternalServerErrorOnExceptionMiddleware : IMiddleware
{
private readonly RequestDelegate next;

public InternalServerErrorOnExceptionMiddleware(RequestDelegate next) => this.next = next;

public async Task Invoke(HttpContext context)
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{
try
{
await this.next.Invoke(context).ConfigureAwait(false);
await next.Invoke(context).ConfigureAwait(false);
}
catch
{
Expand Down

0 comments on commit eacb408

Please sign in to comment.