Created
March 31, 2014 19:39
-
-
Save xdumaine/9900498 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var baseAddress = new Uri(API_URL_BASE); | |
var cookieContainer = new CookieContainer(); | |
using (var handler = new HttpClientHandler() { CookieContainer = cookieContainer }) | |
using (var client = new HttpClient(handler) { BaseAddress = baseAddress }) | |
{ | |
// some defaults, add a header and cookie for authenticating with the API | |
client.DefaultRequestHeaders.Add("User-Agent", USER_AGENT); | |
client.DefaultRequestHeaders.Add("X-AvoSig", AvoSignature); | |
cookieContainer.Add(baseAddress, new Cookie(COOKIE_NAME, CookieValue)); | |
// Post the content and return the result | |
var response = client.PostAsync(uri, content); | |
return response.Result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment