Ejemplo n.º 1
0
        private static async Task <HttpResponse> RequestAsync(HttpRequest request)
        {
            var settings    = new ProxySettings();
            var proxyClient = new NoProxyClient(settings);

            using var client = new RLHttpClient(proxyClient);
            return(await client.SendAsync(request));
        }
Ejemplo n.º 2
0
        public async Task SendAsync_Get_Cookies()
        {
            var name  = "name";
            var value = "value";

            var cookies = new Dictionary <string, string>();

            var message = new HttpRequest
            {
                Method  = HttpMethod.Get,
                Uri     = new Uri($"http://httpbin.org/cookies/set?{name}={value}"),
                Cookies = cookies
            };

            var settings    = new ProxySettings();
            var proxyClient = new NoProxyClient(settings);

            using var client = new RLHttpClient(proxyClient);

            var response = await client.SendAsync(message);

            Assert.Single(cookies);
            Assert.Equal(value, cookies[name]);
        }