in src/common/contentType.ts [11:26]
export function parseContentType(contentTypeValue: string | undefined): ContentType | undefined {
if (!contentTypeValue) {
return undefined;
}
const [mediaType, ...args] = contentTypeValue.split(";").map((s) => s.trim().toLowerCase());
const parameters: Record<string, string> = {};
for (const param of args) {
const [key, value] = param.split("=").map((s) => s.trim().toLowerCase());
if (key && value) {
parameters[key] = value;
}
}
return { mediaType, parameters };
}