コード例 #1
0
        internal static HttpMessageHandler GetMessageHandler(bool useDefaultCredentials)
        {
            if (MockHandlerQueue.Count > 0)
            {
                return(MockHandlerQueue.Dequeue());
            }

            return(new HttpClientHandler {
                UseDefaultCredentials = useDefaultCredentials, Proxy = System.Net.WebRequest.DefaultWebProxy
            });
        }
        internal static HttpMessageHandler GetMessageHandler(bool useDefaultCredentials)
        {
            if (MockHandlerQueue.Count > 0)
            {
                return(MockHandlerQueue.Dequeue());
            }

            return(new HttpClientHandler {
                UseDefaultCredentials = useDefaultCredentials, Proxy = PlatformPlugin.WebProxyProvider.GetDefaultWebProxy()
            });
        }
        internal static HttpMessageHandler GetMessageHandler(bool useDefaultCredentials)
        {
            if (MockHandlerQueue.Count > 0)
            {
                return(MockHandlerQueue.Dequeue());
            }

            return(new HttpClientHandler {
                UseDefaultCredentials = useDefaultCredentials
            });
        }
        internal static HttpMessageHandler GetMessageHandler(bool useDefaultCredentials)
        {
            if (UseMocks)
            {
                if (MockHandlerQueue.Count > 0)
                {
                    return(MockHandlerQueue.Dequeue());
                }

                throw new ArgumentException("No mocks available to consume");
            }

            return(new HttpClientHandler {
                UseDefaultCredentials = useDefaultCredentials, Proxy = WebProxyProvider.DefaultWebProxy
            });
        }