export function isJsonContentType()

in src/common/contentType.ts [30:46]


export function isJsonContentType(contentType: ContentType | undefined): boolean {
    const mediaType = contentType?.mediaType;
    if (!mediaType) {
        return false;
    }

    const typeParts: string[] = mediaType.split("/");
    if (typeParts.length !== 2) {
        return false;
    }

    if (typeParts[0] !== "application") {
        return false;
    }

    return typeParts[1].split("+").includes("json");
}