Example #1
0
 /**
  * @param Request $req
  * @param Response $res
  */
 public function handle(Request &$req, Response &$res)
 {
     $contentType = $req->getHeader("Content-Type");
     if ($contentType != null && is_string($contentType) && $contentType == "application/json") {
         $json = $this->input == null ? file_get_contents('php://input') : $this->input;
         $jsonAsArray = json_decode($json, true);
         if ($jsonAsArray == null) {
             return;
         }
         $req->setParam("body", $jsonAsArray);
     }
 }