/**
  * Return routes that match the current request
  * @return array[Slim_Route]
  */
 public function getMatchedRoutes($reload = false)
 {
     if ($reload || is_null($this->matchedRoutes)) {
         $this->matchedRoutes = array();
         $method = $this->request->isHead() ? Slim_Http_Request::METHOD_GET : $this->request->getMethod();
         foreach ($this->routes[$method] as $route) {
             if ($route->matches($this->request->getResourceUri())) {
                 $this->matchedRoutes[] = $route;
             }
         }
     }
     return $this->matchedRoutes;
 }
Exemple #2
0
 /**
  * Test sets HTTP method
  */
 public function testGetMethod()
 {
     $env = Slim_Environment::mock(array('REQUEST_METHOD' => 'GET'));
     $req = new Slim_Http_Request($env);
     $this->assertEquals('GET', $req->getMethod());
 }
Exemple #3
0
 /**
  * Test sets HTTP method
  */
 public function testGetMethod()
 {
     $env = Slim_Environment::getInstance();
     $req = new Slim_Http_Request($env);
     $this->assertEquals('GET', $req->getMethod());
 }
Exemple #4
0
 public function testGetMethod()
 {
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $r = new Slim_Http_Request();
     $this->assertEquals($_SERVER['REQUEST_METHOD'], $r->getMethod());
 }