示例#1
0
 public function getBody()
 {
     if ($this->hasHeader('Content-Type')) {
         list($content, $properties) = Request::parseHeader($this->getHeader('Content-Type'));
         if ($content === 'application/json') {
             return json_decode($this->body);
         }
     }
     // No match
     return $this->body;
 }
示例#2
0
 public function getBody()
 {
     if ($this->hasHeader('Content-Type')) {
         list($content, $properties) = Request::parseHeader($this->getHeader('Content-Type'));
         if ($content === 'application/json') {
             return json_encode($this->body);
         } elseif ($content === 'application/x-www-form-urlencoded') {
             return http_build_query($this->body);
         }
     }
     // No match
     return $this->body;
 }