Ejemplo n.º 1
0
        /// <summary>
        /// An override of the SendAsync Function from HttpClient. This is done to automatically add the needed MS-CV tracking header to every request (along with our user-agent).
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) //Overriding the SendAsync so we can easily add the CorrelationVector and User-Agent to every request.
        {
            request.Headers.Add("MS-CV", _cv.GetValue());
            _cv.Increment();
            HttpResponseMessage response = await base.SendAsync(request);

            return(response);
        }