public Task <IResponse> Get(string url, Action <IRequest> prepareRequest, bool isLongRunning) { return(HttpHelper.GetAsync(url, request => { request.ConnectionGroupName = isLongRunning ? _longRunningGroup : _shortRunningGroup; var req = new HttpWebRequestWrapper(request); prepareRequest(req); PrepareClientRequest(req); }).Then(response => (IResponse) new HttpWebResponseWrapper(response))); }
public Task<IResponse> Get(string url, Action<IRequest> prepareRequest, bool isLongRunning) { return HttpHelper.GetAsync(url, request => { request.ConnectionGroupName = isLongRunning ? _longRunningGroup : _shortRunningGroup; var req = new HttpWebRequestWrapper(request); prepareRequest(req); PrepareClientRequest(req); }).Then(response => (IResponse) new HttpWebResponseWrapper(response)); }
private void PrepareClientRequest(HttpWebRequestWrapper req) { // todo: add certificates if (_connection.CookieContainer != null) { req.CookieContainer = _connection.CookieContainer; } if (_connection.Credentials != null) { req.Credentials = _connection.Credentials; } // todo: add proxy }