-
Notifications
You must be signed in to change notification settings - Fork 272
Head
chrissie1 edited this page Dec 26, 2012
·
1 revision
According to W3 the Head method does the following.
The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification.
Go to The Get method for the syntax. Just replace the Get method by Head like this.
var http = new HttpClient();
http.Request.Accept = HttpContentTypes.ApplicationJson;
var result = http.Get("http://localhost:55360/trees", new { Id = 2 });
var tree = result.DynamicBody;
Console.WriteLine(tree.Id);
Console.WriteLine(tree.Genus);