Isolate Netlify, Firebase and Helper functions + Import from absolute paths
This commit is contained in:
27
helpers/utils/contenttypes.js
Normal file
27
helpers/utils/contenttypes.js
Normal file
@@ -0,0 +1,27 @@
|
||||
export const knownContentTypes = [
|
||||
"application/json",
|
||||
"application/vnd.api+json",
|
||||
"application/hal+json",
|
||||
"application/xml",
|
||||
"application/x-www-form-urlencoded",
|
||||
"text/html",
|
||||
"text/plain",
|
||||
]
|
||||
|
||||
export function isJSONContentType(contentType) {
|
||||
if (contentType.includes(";")) {
|
||||
const [justContentType] = contentType.split(";")
|
||||
|
||||
return (
|
||||
justContentType === "application/json" ||
|
||||
justContentType === "application/vnd.api+json" ||
|
||||
justContentType === "application/hal+json"
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
contentType === "application/json" ||
|
||||
contentType === "application/vnd.api+json" ||
|
||||
contentType === "application/hal+json"
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user