Skip to content

Commit

Permalink
Merge pull request #861 from sackri10/patch-1
Browse files Browse the repository at this point in the history
Update ResponseLoggingMiddleware.cs
  • Loading branch information
iammukeshm authored May 2, 2023
2 parents 2a5f327 + 5e94754 commit 56dc423
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Infrastructure/Middleware/ResponseLoggingMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ public class ResponseLoggingMiddleware : IMiddleware

public async Task InvokeAsync(HttpContext httpContext, RequestDelegate next)
{
await next(httpContext);

var originalBody = httpContext.Response.Body;
using var newBody = new MemoryStream();
httpContext.Response.Body = newBody;
await next(httpContext);
string responseBody;
if (httpContext.Request.Path.ToString().Contains("tokens"))
{
Expand Down Expand Up @@ -48,4 +49,4 @@ public async Task InvokeAsync(HttpContext httpContext, RequestDelegate next)
newBody.Seek(0, SeekOrigin.Begin);
await newBody.CopyToAsync(originalBody);
}
}
}

0 comments on commit 56dc423

Please sign in to comment.