/// <inheritdoc /> public async Task <FluentHttpResponse> Invoke(FluentHttpRequest request) { if (!_logger.IsEnabled(LogLevel.Information)) { return(await _next(request)); } var options = request.GetLoggingOptions(_options); if (request.Message.Content == null || !options.ShouldLogDetailedRequest.GetValueOrDefault(false)) { _logger.LogInformation("Pre-request... {request}", request); } else { var requestContent = await request.Message.Content.ReadAsStringAsync(); _logger.LogInformation("Pre-request... {request}\nContent: {requestContent}", request, requestContent); } var response = await _next(request); if (response.Content == null || !options.ShouldLogDetailedResponse.GetValueOrDefault(false)) { _logger.LogInformation("Post-request... {response}", response); return(response); } var responseContent = await response.Content.ReadAsStringAsync(); _logger.LogInformation("Post-request... {response}\nContent: {responseContent}", response, responseContent); return(response); }