コード例 #1
0
        public async Task Execute()
        {
            while (true)
            {
                //Get the html code from the google home page
                await httpClient.Get("http://www.google.com");

                //Asynchronously, get the json from jsonplaceholder and serialize it.
                httpClient.Get <List <Todo> >("https://jsonplaceholder.typicode.com/todos/", options =>
                {
                    options.RequestMediaType = new JsonHttpMediaType();
                    options.AddHeader("Authorization", "Bearer <token>");
                    options.QueryStrings.Add("name", "John Doe");
                }).Subscribe();

                tmdbConsumer.ListMovies().Subscribe();

                httpClient.Post <Identifiable>(@"https://jsonplaceholder.typicode.com/posts", new Post()
                {
                    Title  = "Foo",
                    Body   = "Bar",
                    UserId = 3
                }).Subscribe();

                await httpClient.Post(@"https://postman-echo.com/post");
            }
        }
コード例 #2
0
        public async Task Execute()
        {
            await httpClient.Get("http://google.com");

            await tmdbConsumer.ListMovies();

            await jsonPlaceHolderConsumer.GetTodos();

            await jsonPlaceHolderConsumer.SendPost(new Post()
            {
                Title  = "Foo",
                Body   = "Bar",
                UserId = 3
            });
        }
コード例 #3
0
        public async void TestGetAsStringContent()
        {
            var response = await http.Get("http://google.com");

            Assert.NotNull(response);
        }
コード例 #4
0
ファイル: RequestTests.cs プロジェクト: lucassklp/Rx.Http
        public async Task TestGetAsJsonObject()
        {
            var todos = await http.Get <List <Todo> >("https://jsonplaceholder.typicode.com/todos/");

            Assert.NotNull(todos);
        }