src/Http/Formatting/HttpBodyParser.php
public function getMimeType(?IHttpBody $body): ?string
    {
        if ($body === null) {
            return null;
        }

        $parsedMimeTypeCacheKey = spl_object_hash($body);

        if (isset($this->parsedMimeTypeCache[$parsedMimeTypeCacheKey])) {
            return $this->parsedMimeTypeCache[$parsedMimeTypeCacheKey];
        }

        $fileInfo = new finfo(FILEINFO_MIME_TYPE);

        if (($mimeType = $fileInfo->buffer($body->readAsString())) === false) {
            throw new RuntimeException('Could not determine mime type of body');
        }

        // Cache this for next time
        $this->parsedMimeTypeCache[$parsedMimeTypeCacheKey] = $mimeType;

        return $mimeType;
    }
public function getMimeType(?IHttpBody $body): ?string
    {
        if ($body === null) {
            return null;
        }

        $parsedMimeTypeCacheKey = spl_object_hash($body);

        if (isset($this->parsedMimeTypeCache[$parsedMimeTypeCacheKey])) {
            return $this->parsedMimeTypeCache[$parsedMimeTypeCacheKey];
        }

        $fileInfo = new finfo(FILEINFO_MIME_TYPE);

        if (($mimeType = $fileInfo->buffer($body->readAsString())) === false) {
            throw new RuntimeException('Could not determine mime type of body');
        }

        // Cache this for next time
        $this->parsedMimeTypeCache[$parsedMimeTypeCacheKey] = $mimeType;

        return $mimeType;
    }
Gets the MIME type of the body

@param IHttpBody $body The body whose MIME type we want
@return string|null The mime type if one is set, otherwise null
@throws RuntimeException Thrown if the MIME type could not be determined