Created
August 15, 2011 07:03
-
-
Save johnsheehan/1145827 to your computer and use it in GitHub Desktop.
httpsharp prototype
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
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var http = new HttpRequest("http://google.com/?q={search}"); | |
| http.Headers["Content-Type"] = "text/xml"; | |
| http.Headers.Authorization = "foo"; | |
| http.UrlSegments.search = "bar"; | |
| http.Completed = response => | |
| { | |
| if (response.StatusCode == HttpStatusCode.OK) | |
| { | |
| // we're cool | |
| } | |
| Console.WriteLine(response.Content); | |
| }; | |
| http.Exception = ex => | |
| { | |
| throw ex; | |
| }; | |
| http.Get(); | |
| Console.ReadLine(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment