Example #1
0
 /**
  * Gets the body of the HTTP request, if it exists.
  * @return string|null
  */
 public function body()
 {
     if (!$this->m_body && $_SERVER['REQUEST_METHOD'] !== 'GET') {
         $this->m_body = file_get_contents('php://input');
         $content_type = strtok($this->header('Content-Type'), ';');
         if ($decoder = Application::content_type_decoder($content_type)) {
             $this->m_body = $decoder($this->m_body);
         }
     }
     return $this->m_body;
 }