How we can ignore writing file contents in RequestResponseLoggingMiddleware AspNetcore3

207 Views Asked by At

Is this correct way when I don't want to log the file data using the given condition, that the contentType is application/json or any other way is there to skip writing the file contents?

if (context.Response.ContentType.Contains("application/json"))
{
logger(responseBody);
}

if (!context.Request.ContentType.Contains("application/json"))
{
logger(requestBody);
}
0

There are 0 best solutions below