Altairis.Fakturoid.Client.FakturoidContext.GetHttpClient C# (CSharp) Method

GetHttpClient() private method

Gets the System.Net.Http.HttpClient class, initialized for use with Fakturoid API.
private GetHttpClient ( ) : HttpClient
return System.Net.Http.HttpClient
        internal HttpClient GetHttpClient()
        {
            // Get value of authentication header
            var authHeader = Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Join(":", this.EmailAddress, this.AuthenticationToken)));

            // Setup HTTP client
            var client = new HttpClient();
            client.BaseAddress = new Uri(string.Format(API_BASE_URL_FORMAT, this.AccountName));
            client.DefaultRequestHeaders.Add("User-Agent", this.UserAgent);
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeader);

            return client;
        }