private async Task <HttpResponseMessage> GetAsync(string requestURI) { using (var client = new ClientProvider().Client) { client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", "dGVzdDp0ZXN0"); var response = await client.GetAsync(requestURI); return(response.EnsureSuccessStatusCode()); } }
private async Task <HttpResponseMessage> PutAsync(string requestURI, string JsonCar) { using (var client = new ClientProvider().Client) { client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", "dGVzdDp0ZXN0"); HttpContent content = new StringContent(JsonCar, Encoding.UTF8, "application/json"); var response = await client.PutAsync(requestURI, content); return(response.EnsureSuccessStatusCode()); } }