示例#1
0
 /**
  * Routes the request the handler most appropriate.
  *
  * @return void
  */
 protected function routeRequest()
 {
     $match = $this->router->match($this->api->resources, $this->request->getMethod(), $this->request->getPathInfo());
     switch ($match->status) {
         case Router::FOUND:
             $this->routeToHandlers($match);
             break;
         case Router::NOT_FOUND:
             $this->routeToNotFound();
             break;
         case Router::METHOD_NOT_ALLOWED:
             $this->routeToNotAllowed($match);
             break;
     }
 }
示例#2
0
 /**
  * Test environment's PATH_INFO retains URL encoded characters (e.g. #)
  *
  * In earlier version, \Slim\Environment would use PATH_INFO instead
  * of REQUEST_URI to determine the root URI and resource URI.
  * Unfortunately, the server would URL decode the PATH_INFO string
  * before it was handed to PHP. This prevented certain URL-encoded
  * characters like the octothorpe from being delivered correctly to
  * the Slim application environment. This test ensures the
  * REQUEST_URI is used instead and parsed as expected.
  */
 function testPathInfoRetainsUrlEncodedCharacters()
 {
     $req = new Request();
     $req->mock(array("SCRIPT_NAME" => "/index.php", "SCRIPT_FILENAME" => "/var/www/index.php", "REQUEST_URI" => "/foo/%23bar", "PATH_INFO" => "/bar/xyz"));
     $this->assertEquals("/foo/%23bar", $req->getPathInfo());
 }