/// <summary> /// Initializes the configured HTTP client. /// </summary> private void InitializeGitHubApiHttpClient() { _httpClient = new HttpClient { BaseAddress = new Uri(_webCfgRdr.GetAppSetting <string>("BaseGitHubApiUrl")) }; // clear the default headers _httpClient.DefaultRequestHeaders.Accept.Clear(); // TODO: (?) Read the accept header value from the Web.config file _httpClient.DefaultRequestHeaders.Add("Accept", "application/vnd.github.v3+json"); // https://stackoverflow.com/questions/2482715/the-server-committed-a-protocol-violation-section-responsestatusline-error _httpClient.DefaultRequestHeaders.Add("User-Agent", "PRHawkSkf"); }
/// <summary> /// Gets the username. /// </summary> /// <returns> /// A string containing the 'username' to be used when accessing the /// GitHub API(s). /// </returns> public string GetUsername() { var result = _webCfgRdr.GetAppSetting <string>("GitHubAPIUsername"); return(result); }