예제 #1
0
 private void Setup(Service2ServicePolicy policy)
 {
     HeaderName = policy.HeaderName;
     KeyName    = policy.KeyName;
     Trace.Assert(!string.IsNullOrEmpty(HeaderName));
     Trace.Assert(!string.IsNullOrEmpty(KeyName));
 }
예제 #2
0
 public CreyRequest AddS2SHeader(Service2ServicePolicy policiy)
 {
     Headers.AddService2ServiceHeaderPolicy(client_.configuration_, policiy);
     return(this);
 }
예제 #3
0
        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));
        }
예제 #4
0
        public static void AddService2ServiceHeaderPolicy(this HttpRequestMessage httpRequest, IConfiguration config, Service2ServicePolicy policy)
        {
            var apiKey = config.GetValue <string>(policy.KeyName);

            httpRequest.Headers.Add(policy.HeaderName, apiKey);
        }