Example #1
0
 /**
  * Handle image requests
  * 
  * @param Request 			$request
  * @return Response|false
  */
 public function handle(Request $request)
 {
     $this->method = $request->method();
     $this->parseRequestUri($request->uri());
     // GET = image render / info
     if ($this->method === 'GET') {
         return $this->handleGetRequest($request);
     } elseif ($this->method === 'POST') {
         return $this->handlePostRequest($request);
     } elseif ($this->method === 'DELETE') {
         return $this->handleDeleteRequest($request);
     }
 }
 /**
  * Test Request::uri
  */
 public function testUri()
 {
     $request = new Request('GET', '/hello');
     $this->assertEquals('/hello', $request->uri());
     // missing starting slash
     $request = new Request('GET', 'hello');
     $this->assertEquals('/hello', $request->uri());
     // cutting of the query parameters
     $request = new Request('GET', 'hello?nope=this&is=the&wrong=place');
     $this->assertEquals('/hello', $request->uri());
     // string convert
     $request = new Request('GET', 123);
     $this->assertEquals('/123', $request->uri());
 }