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; }
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; }