function testMethod() { $r = new RestRequest(); $this->assertFalse($r->isPost()); $this->assertFalse($r->isPut()); $this->assertFalse($r->isDelete()); $this->assertTrue($r->isGet()); $this->assertEquals($r->getMethod(), "GET"); }
/** * Handles the response * * @param array $route The route for this request * @param array $args The request arguments * * @return void */ protected function respond($route, $args) { $method = $this->request->getMethod(); if ($method == 'GET' && empty($route['noEtag'])) { $this->response->generateETagHeader(); } //leaving this logic split out in case more actions on rawreply need added in the future if (!empty($route['rawReply'])) { if ($method == 'POST') { $this->response->setPostHeaders(); } } else { $this->setResponseType($args); } }
public function setMethod() { $fixture = new RestRequest(); $fixture->setMethod(HttpConstants::GET); $this->assertEquals(HttpConstants::GET, $fixture->getMethod()); }