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"); } }
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 }); }
public async void TestGetAsStringContent() { var response = await http.Get("http://google.com"); Assert.NotNull(response); }
public async Task TestGetAsJsonObject() { var todos = await http.Get <List <Todo> >("https://jsonplaceholder.typicode.com/todos/"); Assert.NotNull(todos); }