public void UserAgent() { HttpRequestMessage message = new HttpRequestMessage(); message.AddUserAgent(); var productVersion = typeof(KvMetadata).GetTypeInfo().Assembly.GetName().Version; string expectedUserAgent = string.Format("OrchestrateDotNetClient/{0}", productVersion); Assert.Contains(expectedUserAgent, message.Headers.UserAgent.ToString()); }
public async Task <RestResponse> SendAsync <T>(HttpRequestMessage message, HttpMethod method, T content) { message.AddUserAgent(); if (content != null) { message.AddContent(content, serializer); } using (var httpClient = CreateHttpClient()) { var response = await httpClient.SendAsync(message); if (response.IsSuccessStatusCode) { return(await RestResponse.CreateAsync(response)); } else { throw await RequestExceptionUtility.Make(response); } } }