Created
June 22, 2015 20:03
-
-
Save mattwcole/5124b49cd9efec4bd7eb to your computer and use it in GitHub Desktop.
C# HttpClient DeleteAsync() with Header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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