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