示例#1
0
        public void getVehicle(MockRequest request)
        {
            var key = GenerateKey(request);

            if (blackHouse.CheckInBlack(key))
            {
                return;
            }
            var response = Call(request.Url);

            if (!response.IsSuccessStatusCode)
            {
                if (response.StatusCode == HttpStatusCode.Unauthorized)
                {
                    RefreshToken();
                }
                blackHouse.Handle(key, request);
            }
            else
            {
                blackHouse.Remove(key);
            }
        }
示例#2
0
 public void Add(string key, MockRequest child)
 {
     children.Add(key, child);
 }
示例#3
0
 private static string GenerateKey(MockRequest request)
 {
     return(request.Method + request.Url);
 }