Exemplo n.º 1
0
 /// <exception cref="System.IO.IOException"></exception>
 public virtual HttpResponse Execute(HttpRequestMessage httpUriRequest)
 {
     capturedRequests.AddItem(httpUriRequest);
     foreach (string urlPattern in responders.Keys)
     {
         if (urlPattern.Equals("*") || httpUriRequest.GetURI().GetPath().Contains(urlPattern
                                                                                  ))
         {
             CustomizableMockHttpClient.Responder responder = responders.Get(urlPattern);
             return(responder.Execute(httpUriRequest));
         }
     }
     throw new RuntimeException("No responders matched for url pattern: " + httpUriRequest
                                .GetURI().GetPath());
 }
Exemplo n.º 2
0
 /// <exception cref="System.IO.IOException"></exception>
 public virtual HttpResponse Execute(HttpRequestMessage httpUriRequest)
 {
     DelayResponseIfNeeded();
     Log.D(Database.Tag, "execute() called with request: " + httpUriRequest.GetURI().GetPath
               ());
     capturedRequests.AddItem(httpUriRequest);
     foreach (string urlPattern in responders.Keys)
     {
         if (urlPattern.Equals("*") || httpUriRequest.GetURI().GetPath().Contains(urlPattern
                                                                                  ))
         {
             CustomizableMockHttpClient.Responder responder = responders.Get(urlPattern);
             HttpResponse response = responder.Execute(httpUriRequest);
             NotifyResponseListeners(httpUriRequest, response);
             return(response);
         }
     }
     throw new RuntimeException("No responders matched for url pattern: " + httpUriRequest
                                .GetURI().GetPath());
 }