public async Task <T> PostAsAsyncWithRegistrationToken <T>(string Method, object Body) { string path = string.Format("{0}{1}", ConfigurationManager.AppSettings["NotifEyeIntegratedAPIEndpoint"], Method); var httpClient = new HttpClient(); httpClient.DefaultRequestHeaders.Add("RegistrationToken", _httpContextProvider.GetRegistrationToken()); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var response = await httpClient.PostAsync(path, new StringContent(JsonConvert.SerializeObject(Body), Encoding.UTF8, "application/json")); if (response.IsSuccessStatusCode) { return(await response.Content.ReadAsAsync <T>()); } else { throw PrepareHttpException(response, Method); } }