public TeamscaleUpload(TeamscaleServer server) { this.server = server; this.messageFormatter = new MessageFormatter(server); HttpClientUtils.SetUpBasicAuthentication(client, server); }
/// <summary> /// Changes the given client's authorization to Basic with the credentials configured for the given server. /// </summary> public static void SetUpBasicAuthentication(HttpClient client, TeamscaleServer server) { byte[] byteArray = Encoding.ASCII.GetBytes($"{server.Username}:{server.AccessKey}"); client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray)); }
public MessageFormatter(TeamscaleServer server) { this.server = server; }