public static async Task <HttpResponseMessage> HttpGet(this HttpClient client, string url, CacheControlHeaderValue cacheControlHeaderValue = null)
        {
            var requestMessage = new HttpRequestMessage(HttpMethod.Get, url);

            requestMessage.AddCacheControl(cacheControlHeaderValue);
            var responseMessage = await client.SendAsync(requestMessage);

            return(responseMessage);
        }
        public void DoNotAddCacheControl()
        {
            // ARRANGE
            var request = new HttpRequestMessage();

            // ACT
            request.AddCacheControl();

            // ASSERT
            Assert.IsTrue(request.Headers.CacheControl == null);
        }
        public void AddCacheControl()
        {
            // ARRANGE
            var request = new HttpRequestMessage();

            // ACT
            request.AddCacheControl(new CacheControlHeaderValue {
                NoCache = true
            });

            // ASSERT
            Assert.IsTrue(request.Headers.CacheControl.NoCache);
        }
        public static async Task <HttpResponseMessage> HttpPost(this HttpClient client, string url, string bodyContent, CacheControlHeaderValue cacheControlHeaderValue = null)
        {
            var content = new StringContent(bodyContent);

            content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");

            var requestMessage = new HttpRequestMessage(HttpMethod.Post, url);

            requestMessage.AddCacheControl(cacheControlHeaderValue);
            requestMessage.Content = content;

            var responseMessage = await client.SendAsync(requestMessage);

            return(responseMessage);
        }