/// <inheritdoc />
        public async Task <FluentHttpResponse> Invoke(FluentHttpRequest request)
        {
            var watch = Stopwatch.StartNew();

            FluentHttpResponse response;

            try
            {
                response = await _next(request);
            }
            finally
            {
                var threshold = request.GetTimerWarnThreshold()
                                .GetValueOrDefault(_options.WarnThreshold);

                if (_logger.IsEnabled(LogLevel.Warning) && watch.Elapsed > threshold)
                {
                    _logger.LogWarning(TimeTakenMessage, request, watch.Elapsed.TotalMilliseconds);
                }
                else if (_logger.IsEnabled(LogLevel.Information))
                {
                    _logger.LogInformation(TimeTakenMessage, request, watch.Elapsed.TotalMilliseconds);
                }
            }

            return(response.SetTimeTaken(watch.Elapsed));
        }