Skip to content

Instantly share code, notes, and snippets.

@johnsheehan
Created August 15, 2011 07:03
Show Gist options
  • Save johnsheehan/1145827 to your computer and use it in GitHub Desktop.
Save johnsheehan/1145827 to your computer and use it in GitHub Desktop.
httpsharp prototype
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