public function getRawContent(int $max_length = -1)
    {
        // Set maximum length based on parameter or provided content_length
        $max_length = $max_length < 0 ? $this->content_length : $max_length;
        // Limit to a maximum of 4MiB
        $max_length = min(4096 * 1024, $max_length, $this->content_length);

        $str = $this->getContentStream();
        $data = stream_get_contents($str, $this->content_length);
        $size = strlen($data);
        if ($size < $max_length)
        {
            self::getLogger()->warning(
                "Less data was posted than promised. Content-length was {} but only {} bytes were received",
                [$this->content_length, $size]
            );
        }
        return $data;
    }