protected function getFormat(string $payload): string
    {
        $format = '';

        if (\is_file($file = $payload)) {
            $format = \pathinfo($file, \PATHINFO_EXTENSION);
        } elseif (\is_string($payload)) {
            // try if content is json
            \json_decode($payload);

            if (\json_last_error() === \JSON_ERROR_NONE) {
                return 'json';
            }

            $format = (new finfo(\FILEINFO_MIME_TYPE))->buffer($payload);
        }

        return self::$supportedMimeTypes[$format] ?? $format;
    }