Skip to content

Instantly share code, notes, and snippets.

@mattwcole
Created June 22, 2015 20:03
Show Gist options
  • Save mattwcole/5124b49cd9efec4bd7eb to your computer and use it in GitHub Desktop.
Save mattwcole/5124b49cd9efec4bd7eb to your computer and use it in GitHub Desktop.
C# HttpClient DeleteAsync() with Header
class Program
{
static void Main()
{
HttpAsync().Wait();
Console.ReadKey();
}
private static async Task HttpAsync()
{
using (var client = new HttpClient {BaseAddress = new Uri("http://localhost:61415")})
{
client.DefaultRequestHeaders.Add("X-Parse-Application-Id", new[] {"12345"});
using (var result = await client.DeleteAsync("/api/values/55"))
{
result.EnsureSuccessStatusCode();
Console.WriteLine("success");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment