示例#1
0
        public void GetWebRequestWithProxy()
        {
            var request = HttpRequestTest.SetContent();

            request.WebProxy = new WebProxy();

            var httpWebRequest = HttpResponse.GetWebRequest(request);
        }
示例#2
0
        public void GetWebRequestWithIgnoreCertificate()
        {
            var request = HttpRequestTest.SetContent();

            request.SetHttpsInsecure(true);

            var httpWebRequest = HttpResponse.GetWebRequest(request);
        }
示例#3
0
        public void GetWebRequestWithProxy()
        {
            HttpRequest request = HttpRequestTest.SetContent();

            request.WebProxy = new System.Net.WebProxy();

            HttpWebRequest httpWebRequest = HttpResponse.GetWebRequest(request);
        }
示例#4
0
        public void GetWebRequestWithProxy()
        {
            var request = HttpRequestTest.SetContent();

            request.WebProxy = null;

            var httpWebRequest = HttpResponse.GetWebRequest(request);

            Assert.NotNull(httpWebRequest);
        }
示例#5
0
        public void GetWebRequestWithTimeout()
        {
            var request        = HttpRequestTest.SetContent();
            var httpWebRequest = HttpResponse.GetWebRequest(request);

            Assert.Equal(5000, httpWebRequest.Timeout);
            Assert.Equal(10000, httpWebRequest.ReadWriteTimeout);

            request.SetConnectTimeoutInMilliSeconds(1024);
            request.SetReadTimeoutInMilliSeconds(2048);
            httpWebRequest = HttpResponse.GetWebRequest(request);

            Assert.Equal(2048, httpWebRequest.ReadWriteTimeout);
            Assert.Equal(1024, httpWebRequest.Timeout);
        }
示例#6
0
        public void GetWebRequest()
        {
            var request        = HttpRequestTest.SetContent();
            var httpWebRequest = HttpResponse.GetWebRequest(request);

            Assert.IsType <HttpWebRequest>(httpWebRequest);
            Assert.Equal("application/octet-stream", httpWebRequest.ContentType);

            request.Headers.Add("Accept", "accept");
            request.Headers.Add("Date", "Thu, 24 Jan 2019 05:16:46 GMT");

            request.Method = MethodType.POST;
            httpWebRequest = HttpResponse.GetWebRequest(request);
            Assert.IsType <HttpWebRequest>(httpWebRequest);
            Assert.Equal("application/octet-stream", httpWebRequest.ContentType);
        }