From a33194e933529e3421b7930ed19168ef9606b81c Mon Sep 17 00:00:00 2001 From: Soheil Alizadeh Date: Fri, 17 Jan 2020 18:57:45 +0330 Subject: [PATCH] Avoid to copy cancellation token --- src/raccoonLog.Http/HttpMessageLogMiddleware.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/raccoonLog.Http/HttpMessageLogMiddleware.cs b/src/raccoonLog.Http/HttpMessageLogMiddleware.cs index fb3e76d..54c2092 100644 --- a/src/raccoonLog.Http/HttpMessageLogMiddleware.cs +++ b/src/raccoonLog.Http/HttpMessageLogMiddleware.cs @@ -18,9 +18,7 @@ public HttpMessageLogMiddleware(RequestDelegate next) public async Task Invoke(HttpContext context, IHttpLoggingProvider httpLogging) { - var ct = context.RequestAborted; - - await httpLogging.LogAsync(context.Request, ct); + await httpLogging.LogAsync(context.Request, context.RequestAborted); var originalBody = context.Response.Body; @@ -32,11 +30,11 @@ public async Task Invoke(HttpContext context, IHttpLoggingProvider httpLogging) await _next(context); - await httpLogging.LogAsync(context.Response, bodyStream, ct); + await httpLogging.LogAsync(context.Response, bodyStream, context.RequestAborted); bodyStream.Position = 0; - await bodyStream.CopyToAsync(originalBody, ct); + await bodyStream.CopyToAsync(originalBody, context.RequestAborted); context.Response.Body = originalBody; }