diff --git a/lib/classes/JsonApi/JsonApiController.php b/lib/classes/JsonApi/JsonApiController.php index a60c0e20abad3a88130e558a0275206ddcb569d7..cece86aeefd833468abcbe54f3822d5659d2bd43 100644 --- a/lib/classes/JsonApi/JsonApiController.php +++ b/lib/classes/JsonApi/JsonApiController.php @@ -402,7 +402,7 @@ class JsonApiController $request = $this->container->get('request'); if ($this->doesRequestHaveBody($request)) { $contentType = $request->getHeader(HeaderParametersParserInterface::HEADER_CONTENT_TYPE); - if (count($contentType)) { + if (count($contentType) > 0) { $mediaType = $this->factory->createMediaType( MediaTypeInterface::JSON_API_TYPE, MediaTypeInterface::JSON_API_SUB_TYPE @@ -418,11 +418,6 @@ class JsonApiController private function doesRequestHaveBody(Request $request): bool { - if (count($request->getHeader('Transfer-Encoding'))) { - return true; - } - $contentLength = $request->getHeader('Content-Length'); - - return count($contentLength) && $contentLength[0] > 0; + return in_array($request->getMethod(), ['POST', 'PATCH']); } }