private async Task<SendResult> Send(MaloneRestRequest request, CancellationToken token) { var result = new SendResult(); var client = new RestClient(request.BaseUrl) { FollowRedirects = false }; result.SentAt = DateTimeOffset.UtcNow; var response = await client.ExecuteTaskAsync(request, token); result.ReceivedAt = DateTimeOffset.UtcNow; result.Response = response; return result; }
public MaloneRestRequest ToMaloneRestRequest() { var url = GetUri(); var baseUrl = GetBaseUrl(url); var resourcePath = GetResourcePath(url); var request = new MaloneRestRequest(url, baseUrl, resourcePath, Method); foreach (var header in Headers.Where(h => h.Name != Header.ContentType)) { request.AddHeader(header.Name, header.Value); } request.AddParameter(Headers.Single(h => h.Name == Header.ContentType).Value, Body, ParameterType.RequestBody); return(request); }
private async Task <SendResult> Send(MaloneRestRequest request, CancellationToken token) { var result = new SendResult(); var client = new RestClient(request.BaseUrl) { FollowRedirects = false }; result.SentAt = DateTimeOffset.UtcNow; var response = await client.ExecuteTaskAsync(request, token); result.ReceivedAt = DateTimeOffset.UtcNow; result.Response = response; return(result); }
public MaloneRestRequest ToMaloneRestRequest() { var url = GetUri(); var baseUrl = GetBaseUrl(url); var resourcePath = GetResourcePath(url); var request = new MaloneRestRequest(url, baseUrl, resourcePath, Method); foreach (var header in Headers.Where(h => h.Name != Header.ContentType)) request.AddHeader(header.Name, header.Value); request.AddParameter(Headers.Single(h => h.Name == Header.ContentType).Value, Body, ParameterType.RequestBody); return request; }