public BioworldLoggingScopeHttpMessageHandler(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 BioworldHttpClient(HttpClient client, HttpClientOptions options,
                                  ICorrelationContextFactory correlationContextFactory, ICorrelationIdFactory correlationIdFactory)
        {
            _client  = client;
            _options = options;
            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.CorrelationContextHeader, correlationId);
            }
        }
示例#3
0
 public BioworldHttpLoggingFilter(ILoggerFactory loggerFactory, HttpClientOptions options)
 {
     _loggerFactory = loggerFactory;
     _options       = options;
 }