private static HttpMessageHandler CreateMessageHandler(ODataClientSettings settings)
        {
            if (settings.OnCreateMessageHandler != null)
            {
                return settings.OnCreateMessageHandler();
            }
            else
            {
                var clientHandler = new HttpClientHandler();

                // Perform this test to prevent failure to access Credentials/PreAuthenticate properties on SL5
                if (settings.Credentials != null)
                {
                    clientHandler.Credentials = settings.Credentials;
                    if (clientHandler.SupportsPreAuthenticate())
                        clientHandler.PreAuthenticate = true;
                }

                if (settings.OnApplyClientHandler != null)
                {
                    settings.OnApplyClientHandler(clientHandler);
                }

                return clientHandler;
            }
        }
예제 #2
0
        private static HttpMessageHandler CreateMessageHandler(ODataClientSettings settings)
        {
            if (settings.OnCreateMessageHandler != null)
            {
                return(settings.OnCreateMessageHandler());
            }
            else
            {
                var clientHandler = new HttpClientHandler();

                // Perform this test to prevent failure to access Credentials/PreAuthenticate properties on SL5
                if (settings.Credentials != null)
                {
                    clientHandler.Credentials = settings.Credentials;
                    if (Utils.IsDesktopPlatform() || clientHandler.SupportsPreAuthenticate())
                    {
                        clientHandler.PreAuthenticate = true;
                    }
                }

                if (settings.OnApplyClientHandler != null)
                {
                    settings.OnApplyClientHandler(clientHandler);
                }

                return(clientHandler);
            }
        }
예제 #3
0
        private static HttpMessageHandler CreateMessageHandler(ODataClientSettings settings)
        {
            if (settings.OnCreateMessageHandler != null)
            {
                return(settings.OnCreateMessageHandler());
            }
            else
            {
                var clientHandler = new HttpClientHandler();

                if (settings.Credentials != null)
                {
                    clientHandler.Credentials     = settings.Credentials;
                    clientHandler.PreAuthenticate = true;
                }

                settings.OnApplyClientHandler?.Invoke(clientHandler);

                return(clientHandler);
            }
        }