Created
April 13, 2013 04:13
-
-
Save mikeminutillo/5376901 to your computer and use it in GitHub Desktop.
WebAPI simple http client
This file contains hidden or 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
var request = WebRequest.Create("http://localhost:63180/api/values") as HttpWebRequest; | |
request.Accept = "text/xml;text/json"; | |
var response = request.GetResponse() as HttpWebResponse; | |
new { response.StatusCode, response.ContentType }.Dump("Details"); | |
using(var stream = response.GetResponseStream()) | |
using(var reader = new StreamReader(stream)) | |
reader.ReadToEnd().Dump("Pay Load"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment