Beispiel #1
0
        internal void SetRequestHeaders(HttpRequestMessage request)
        {
            request.Headers.Clear();

            Accept.ForEach(x => request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(x)));
            AcceptEncoding.ForEach(x => request.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue(x)));
            CustomHeaders.ToList().ForEach(x => request.Headers.Add(x.Key, x.Value));
            if (request.Content != null)
            {
                request.Content.Headers.ContentType = new MediaTypeHeaderValue(ContentType);
            }
        }