public ConveyLoggingScopeHttpMessageHandler(ILogger logger, HttpClientOptions options)
 {
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _       = options ?? throw new ArgumentNullException(nameof(options));
     _maskedRequestUrlParts =
         new HashSet <string>(options.RequestMasking?.UrlParts ?? Enumerable.Empty <string>());
     _maskTemplate = string.IsNullOrWhiteSpace(options.RequestMasking?.MaskTemplate)
         ? "*****"
         : options.RequestMasking.MaskTemplate;
 }
Пример #2
0
        public ConveyHttpClient(HttpClient client, HttpClientOptions options,
                                ICorrelationContextFactory correlationContextFactory)
        {
            _client  = client;
            _options = options;
            if (string.IsNullOrWhiteSpace(_options.CorrelationContextHeader))
            {
                return;
            }

            var correlationContext = correlationContextFactory.Create();

            _client.DefaultRequestHeaders.TryAddWithoutValidation(_options.CorrelationContextHeader,
                                                                  correlationContext);
        }
Пример #3
0
        public ConveyHttpClient(HttpClient client, HttpClientOptions options, IHttpClientSerializer serializer,
                                ICorrelationContextFactory correlationContextFactory, ICorrelationIdFactory correlationIdFactory)
        {
            _client     = client;
            _options    = options;
            _serializer = serializer;
            if (!string.IsNullOrWhiteSpace(_options.CorrelationContextHeader))
            {
                var correlationContext = correlationContextFactory.Create();
                _client.DefaultRequestHeaders.TryAddWithoutValidation(_options.CorrelationContextHeader,
                                                                      correlationContext);
            }

            if (!string.IsNullOrWhiteSpace(_options.CorrelationIdHeader))
            {
                var correlationId = correlationIdFactory.Create();
                _client.DefaultRequestHeaders.TryAddWithoutValidation(_options.CorrelationIdHeader,
                                                                      correlationId);
            }
        }
Пример #4
0
 public ConveyHttpLoggingFilter(ILoggerFactory loggerFactory, HttpClientOptions options)
 {
     _loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
     _options       = options;
 }
Пример #5
0
 public ConveyHttpClient(HttpClient client, HttpClientOptions options, ILogger <IHttpClient> logger)
 {
     _client  = client;
     _options = options;
     _logger  = logger;
 }
Пример #6
0
 public ConveyHttpClient(HttpClient client, HttpClientOptions options)
 {
     _client  = client;
     _options = options;
 }