// Internal for testing
        internal static BlazorHttpConnectionOptions ShallowCopyHttpConnectionOptions(
            BlazorHttpConnectionOptions options)
        {
            var result = new BlazorHttpConnectionOptions
            {
                HttpMessageHandlerFactory = options.HttpMessageHandlerFactory,
                //ClientCertificates = options.ClientCertificates,
                //Cookies = options.Cookies,
                Url                 = options.Url,
                Transports          = options.Transports,
                SkipNegotiation     = options.SkipNegotiation,
                AccessTokenProvider = options.AccessTokenProvider,
                //CloseTimeout = options.CloseTimeout,
                //Credentials = options.Credentials,
                //Proxy = options.Proxy,
                //UseDefaultCredentials = options.UseDefaultCredentials,
                DefaultTransferFormat = options.DefaultTransferFormat,
                //WebSocketConfiguration = options.WebSocketConfiguration,
            };

            result.Headers.Clear();
            foreach (var kvp in options.Headers)
            {
                result.Headers.Add(kvp);
            }

            return(result);
        }
        public BlazorHttpConnectionFactory(
            IOptions <BlazorHttpConnectionOptions> options,
            IJSRuntime jsRuntime,
            NavigationManager navigationManager,
            ILoggerFactory loggerFactory)
        {
            if (jsRuntime is null)
            {
                throw new ArgumentNullException(nameof(jsRuntime));
            }

            if (navigationManager is null)
            {
                throw new ArgumentNullException(nameof(navigationManager));
            }

            _options           = options.Value;
            _jsRuntime         = jsRuntime;
            _navigationManager = navigationManager;
            _loggerFactory     = loggerFactory;
        }
        public BlazorHttpConnection(
            BlazorHttpConnectionOptions options,
            IJSRuntime jsRuntime,
            NavigationManager navigationManager,
            ILoggerFactory?loggerFactory)
        {
            if (jsRuntime == null)
            {
                throw new ArgumentNullException(nameof(jsRuntime));
            }

            if (navigationManager is null)
            {
                throw new ArgumentNullException(nameof(navigationManager));
            }

            _options           = options;
            _jsRuntime         = jsRuntime;
            _navigationManager = navigationManager;
            _loggerFactory     = loggerFactory;
            _logger            = _loggerFactory?.CreateLogger <BlazorHttpConnection>();
            _httpClient        = CreateHttpClient();
            Features.Set <IConnectionInherentKeepAliveFeature>(this);
        }