private void AddCrumbHeader(JenkinsCrumb crumb) { if (!crumb.IsValid()) { return; } _client.DefaultRequestHeaders.Add(crumb.CrumbRequestField, crumb.Crumb); }
public async Task PostAsync(IJenkins jenkinsPlugin, string api, bool useBaseUri = false, JenkinsCrumb crumb = null) { AddCrumbHeader(crumb); var endpoint = GetEndpoint(jenkinsPlugin, api, useBaseUri); var test = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("json", "{\"parameter\":[]}") }); var response = await _client.PostAsync(endpoint, test).ConfigureAwait(false); response.EnsureSuccessStatusCode(); }