Beispiel #1
0
 public ShareResponseBodyFilter(ILogger <ShareResponseBodyFilter> logger
                                , IConfiguration configuration
                                , ResponseCacheData responseCacheData)
 {
     _logger            = logger;
     _configuration     = configuration;
     _responseCacheData = responseCacheData;
 }
Beispiel #2
0
        public async Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next)
        {
            if (_responseCacheData == null || string.IsNullOrEmpty(_responseCacheData.Body))
            {
                var responseHeadersText = await CommonTools.FormatResponseBody(context.HttpContext.Response);

                _responseCacheData = new ResponseCacheData {
                    Body = responseHeadersText
                };
            }
            await next();
        }