private function getParsedBody(Request $request): array
    {
        $contentType = \explode(';', (string) $request->headers->get('content-type'), 2)[0];

        // JSON object
        switch ($contentType) {
            case static::CONTENT_TYPE_JSON:
                $parsedBody = \json_decode($request->getContent(), true);

                if (\JSON_ERROR_NONE !== \json_last_error()) {
                    throw new BadRequestHttpException('POST body sent invalid JSON');
                }
                break;

            case static::CONTENT_TYPE_FORM_DATA:
                $parsedBody = $this->handleUploadedFiles($request->request->all(), $request->files->all());
                break;

            default:
                throw new BadRequestHttpException(\sprintf(
                    'Batching parser only accepts "%s" or "%s" content-type but got %s.',
                    static::CONTENT_TYPE_JSON,
                    static::CONTENT_TYPE_FORM_DATA,
                    \json_encode($contentType)
                ));
        }

        return $parsedBody;
    }