$method = array_key_exists("HTTP_X_HTTP_METHOD", $_SERVER) ? $_SERVER["HTTP_X_HTTP_METHOD"] : $_SERVER["REQUEST_METHOD"];
 $reply->method = $method;
 //sanitize the id
 $id = filter_input(INPUT_GET, "id", FILTER_VALIDATE_INT);
 //Handle REST calls
 if ($method === "GET") {
     //Set XSRF cookie
     setXsrfCookie("/");
     //Get Request based on given field
     if (empty($id) === false) {
         $request = Request::getRequestByRequestId($pdo, $id);
         if ($request !== null) {
             $reply->data = $request;
         }
     } else {
         $request = Request::getAllRequests($pdo);
         if ($request !== null) {
             $reply->data = $request;
         }
     }
 } elseif ($method === "PUT" || $method === "POST") {
     $requestContent = file_get_contents("php://input");
     $requestObject = json_decode($requestContent);
     verifyXsrf();
     if ($method === "POST") {
         //create new request
         $request = new Request(null, $_SESSION["user"]->getUserId(), null, new DateTime(), null, false, $requestObject->requestRequestorText, "");
         $request->insert($pdo);
         $reply->message = "Request submitted successfully";
     }
     //Access::isAdminLoggedIn()
 /**
  * test grabbing all Requests
  **/
 public function testGetAllValidRequests()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("request");
     // create a new Request and insert to into mySQL
     $request = new Request(null, $this->requestor->getUserId(), $this->admin->getUserId(), $this->VALID_REQUESTTIMESTAMP, $this->VALID_REQUESTACTIONTIMESTAMP, $this->requestApprove, $this->VALID_REQUESTREQUESTORTEXT, $this->VALID_REQUESTADMINTEXT);
     $request->insert($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $results = Request::getAllRequests($this->getPDO());
     $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("request"));
     $this->assertCount(1, $results);
     $this->assertContainsOnlyInstancesOf("Edu\\Cnm\\TimeCrunchers\\Request", $results);
     // grab the result from the array and validate it
     $pdoRequest = $results[0];
     $this->assertEquals($pdoRequest->getRequestRequestorId(), $this->requestor->getUserId());
     $this->assertEquals($pdoRequest->getRequestAdminId(), $this->admin->getUserId());
     $this->assertEquals($pdoRequest->getRequestTimeStamp(), $this->VALID_REQUESTTIMESTAMP);
     $this->assertEquals($pdoRequest->getRequestActionTimeStamp(), $this->VALID_REQUESTACTIONTIMESTAMP);
     $this->assertEquals($pdoRequest->getRequestApprove(), $this->requestApprove);
     $this->assertEquals($pdoRequest->getRequestRequestorText(), $this->VALID_REQUESTREQUESTORTEXT2);
     $this->assertEquals($pdoRequest->getRequestAdminText(), $this->VALID_REQUESTADMINTEXT);
 }