Skip to content

Instantly share code, notes, and snippets.

@patriksvensson
Created August 17, 2016 19:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patriksvensson/e2ddbd75ae2fa7a5ec5602b6a6b4a57c to your computer and use it in GitHub Desktop.
Save patriksvensson/e2ddbd75ae2fa7a5ec5602b6a6b4a57c to your computer and use it in GitHub Desktop.
Cake script: Gets the status code from a web request and outputs it.
// Cake script
#r "System.Net"
using System.Net;
var request = (HttpWebRequest)WebRequest.Create("http://google.com");
var response = (HttpWebResponse)request.GetResponse();
var statusCode = response.StatusCode;
Information("Received {0}!", statusCode);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment