Created
December 18, 2013 06:11
-
-
Save FernandoVezzali/8017981 to your computer and use it in GitHub Desktop.
RequestBinExample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
namespace RequestBinExample | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var task = MakeRequest(); | |
task.Wait(); | |
var response = task.Result; | |
var body = response.Content.ReadAsStringAsync().Result; | |
Console.WriteLine(body); | |
} | |
private static async Task MakeRequest() | |
{ | |
var httpClient = new HttpClient(); | |
return await httpClient.GetAsync(new Uri("http://requestb.in/10h36ok1")); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment