예제 #1
0
        public RestResponseHandler Status(HttpStatusCode statusCode, Action <IRestResponse> action)
        {
            var policy = new RestResponseHandlerPolicy(restResponse: _response, predicate: restResponse => restResponse.StatusCode == statusCode, action: action);

            _tailPolicy = _tailPolicy.Next(policy);
            return(this);
        }
예제 #2
0
        public RestResponseHandler ClientError(Action <IRestResponse> action)
        {
            Func <IRestResponse, bool> isClientError = (response) =>
            {
                var statusCode = (int)response.StatusCode;
                return(statusCode >= 400 && statusCode < 500);
            };
            var policy = new RestResponseHandlerPolicy(_response, isClientError, action);

            _tailPolicy = _tailPolicy.Next(policy);
            return(this);
        }
 public RestResponseHandlerPolicy Next(RestResponseHandlerPolicy next)
 {
     _next = next;
     return(_next);
 }