Returns the raw HTTP request body.
public getRawBody ( ) : string | ||
return | string | the request body |
public function getRawBody() { $rawBody = parent::getRawBody(); $contentEncoding = $this->headers->get('Content-Encoding', 'identity'); switch ($contentEncoding) { case 'gzip': $rawBody = @gzdecode($rawBody); if ($rawBody !== false) { return $rawBody; } throw new BadRequestHttpException('Request body(gziped) is broken.'); case 'identity': return $rawBody; default: throw new UnsupportedMediaTypeHttpException('Unsupported Content-Encoding: ' . $contentEncoding); } }