Exemple #1
0
        public async Task ProxyCustomHeadersGetAsyncTest() => await BaseTests.TextTestAsync(
            async (api, cancellationToken) =>
        {
            var response = await api.GetAsync("http://httpbin.org/anything", proxyMode: true, headers: new Dictionary <string, string>
            {
                { "X-MyHeader", "123" },
            }, cancellationToken: cancellationToken);

            Assert.IsTrue(response.Contains("\"X-Myheader\": \"123\""), response);

            return(response);
        });
Exemple #2
0
        public async Task PutAsyncTest() => await BaseTests.TextTestAsync(
            async (api, cancellationToken) =>
        {
            var response = await api.PutAsync("http://httpbin.org/anything", new Dictionary <string, string>
            {
                { "foo", "bar" },
            }, cancellationToken: cancellationToken);

            Assert.IsTrue(response.Contains("\"data\": \"{\\\"foo\\\":\\\"bar\\\"}\""));
            Assert.IsTrue(response.Contains("\"form\": {}"));
            Assert.IsTrue(response.Contains("\"json\": {\n    \"foo\": \"bar\"\n  }"));

            return(response);
        });
Exemple #3
0
        public async Task ProxySessionsGetAsyncTest() => await BaseTests.TextTestAsync(
            async (api, cancellationToken) =>
        {
            const long id = long.MaxValue;
            var response1 = await api.GetAsync("http://httpbin.org/ip", proxyMode: true, sessionNumber: id,
                                               cancellationToken: cancellationToken);

            var response2 = await api.GetAsync("http://httpbin.org/ip", proxyMode: true, sessionNumber: id,
                                               cancellationToken: cancellationToken);

            Assert.AreEqual(response1, response2, "Responses are not equal");

            return(response1 + Environment.NewLine + response2);
        });
Exemple #4
0
 public async Task PremiumGetAsyncTest() => await BaseTests.TextTestAsync(
     (api, cancellationToken) => api.GetAsync("http://httpbin.org/ip", premium: true, cancellationToken: cancellationToken));