Files
hoppscotch/helpers/utils/contenttypes.ts
2021-07-23 18:28:07 +00:00

18 lines
501 B
TypeScript

export const knownContentTypes = {
"application/json": "json",
"application/ld+json": "json",
"application/hal+json": "json",
"application/vnd.api+json": "json",
"application/xml": "xml",
"application/x-www-form-urlencoded": "multipart",
"multipart/form-data": "multipart",
"text/html": "html",
"text/plain": "plain",
}
export type ValidContentTypes = keyof typeof knownContentTypes
export function isJSONContentType(contentType: string) {
return /\bjson\b/i.test(contentType)
}