private HttpRaftRequest CreateRequest(NodeConnectionInfo node, TimeSpan?timeout, string url, HttpMethod httpMethod, ILog logger) { if (timeout.HasValue == false) { timeout = TimeSpan.FromSeconds(20); // use default if not defined } var request = new HttpRaftRequest(node, url, httpMethod, info => { HttpClient client; var dispose = (IDisposable)GetConnection(info, timeout.Value, out client); return(Tuple.Create(dispose, client)); }, _cancellationToken, logger) { UnauthorizedResponseAsyncHandler = HandleUnauthorizedResponseAsync, ForbiddenResponseAsyncHandler = HandleForbiddenResponseAsync }; GetAuthenticator(node).ConfigureRequest(this, new WebRequestEventArgs { Client = request.HttpClient, Credentials = node.ToOperationCredentials() }); return(request); }
private HttpRaftRequest CreateRequest(NodeConnectionInfo node, string url, HttpMethod httpMethod) { var request = new HttpRaftRequest(node, url, httpMethod, info => { HttpClient client; var dispose = (IDisposable)GetConnection(info, out client); return(Tuple.Create(dispose, client)); }, _cancellationToken) { UnauthorizedResponseAsyncHandler = HandleUnauthorizedResponseAsync, ForbiddenResponseAsyncHandler = HandleForbiddenResponseAsync }; GetAuthenticator(node).ConfigureRequest(this, new WebRequestEventArgs { Client = request.HttpClient, Credentials = node.ToOperationCredentials() }); return(request); }