private void Setup(Service2ServicePolicy policy) { HeaderName = policy.HeaderName; KeyName = policy.KeyName; Trace.Assert(!string.IsNullOrEmpty(HeaderName)); Trace.Assert(!string.IsNullOrEmpty(KeyName)); }
public static void AddService2ServiceHeaderPolicy(this List <KeyValuePair <string, string> > headers, IConfiguration config, Service2ServicePolicy policy) { var apiKey = config.GetValue <string>(policy.KeyName); headers.Add(new KeyValuePair <string, string>(policy.HeaderName, apiKey)); }
public static void AddService2ServiceHeaderPolicy(this HttpRequestMessage httpRequest, IConfiguration config, Service2ServicePolicy policy) { var apiKey = config.GetValue <string>(policy.KeyName); httpRequest.Headers.Add(policy.HeaderName, apiKey); }