Ejemplo n.º 1
0
 /// <summary>
 /// Sets the default client settings needed by GET and POST request methods.
 /// </summary>
 /// <param name="client">HttpClient instance.</param>
 /// <remarks>>Does not handle the If-Match header.</remarks>
 private void Settings(HttpClient client)
 {
     client.BaseAddress = BaseAddress;
     client.DefaultRequestHeaders.Accept.Clear();
     client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
     if (Authenticator != null)
     {
         client.DefaultRequestHeaders.Authorization = Authenticator.AuthenticationHeader();
     }
     foreach (var header in CustomHeaders)
     {
         client.DefaultRequestHeaders.TryAddWithoutValidation(header.Key, header.Value);
     }
 }