public TemplateClient( string baseServiceUrl, System.Net.Http.HttpClient httpClient, ApimCredentials config) : this(baseServiceUrl, httpClient) { Config = config; }
private void ConfigRequestApim(HttpClient httpClient, ApimCredentials apim) { string apiKey = "x-api-key"; if (httpClient.DefaultRequestHeaders.Contains(apiKey)) { httpClient.DefaultRequestHeaders.Remove(apiKey); } httpClient.DefaultRequestHeaders.TryAddWithoutValidation(apiKey, $"{apim.ApiKey}"); string apiSubscription = "x-api-subscription"; if (httpClient.DefaultRequestHeaders.Contains(apiSubscription)) { httpClient.DefaultRequestHeaders.Remove(apiSubscription); } httpClient.DefaultRequestHeaders.TryAddWithoutValidation(apiSubscription, $"{apim.SubscriptionKey}"); }