Skip to content

Instantly share code, notes, and snippets.

@avanderhoorn
Created November 25, 2014 22:06
Show Gist options
  • Save avanderhoorn/08b792b1626bf4e5aba8 to your computer and use it in GitHub Desktop.
Save avanderhoorn/08b792b1626bf4e5aba8 to your computer and use it in GitHub Desktop.
HttpClient test
_httpClient.GetAsync("http://localhost:15316/Glimpse/Agent")
.ContinueWith(requestTask =>
{
// Get HTTP response from completed task.
HttpResponseMessage response = requestTask.Result;
// Check that response was successful or throw exception
response.EnsureSuccessStatusCode();
// Read response asynchronously as JsonValue and write out top facts for each country
response.Content.ReadAsAsync<string>().ContinueWith(readTask =>
{
var result = readTask.Result;
});
});
@avanderhoorn
Copy link
Author

Great, thanks mate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment