Skip to content

Instantly share code, notes, and snippets.

@btompkins
Created December 14, 2012 02:11
Show Gist options
  • Save btompkins/4281969 to your computer and use it in GitHub Desktop.
Save btompkins/4281969 to your computer and use it in GitHub Desktop.
[ServiceContract]
public class HelloWorldResource {
[WebGet(UriTemplate="")]
public void Get(HttpRequestMessage req, HttpResponseMessage resp) {
if (req.IfNoneMatch.Contains("HW")) {
resp.StatusCode = HttpStatusCode.NotModified;
return;
}
resp.HttpContent.Create("Hello World Resource", "text/html");
resp.StatusCode = HttpStatusCode.OK;
resp.Headers.Tag = "HW"; //set the tag
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment