masto
Version:
Mastodon API client for JavaScript, TypeScript, Node.js, browsers
25 lines (24 loc) • 626 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEncoding = void 0;
const getEncoding = (headers) => {
const contentType = headers.get("Content-Type")?.replace(/\s*;.*$/, "");
if (typeof contentType !== "string") {
return;
}
switch (contentType) {
case "application/json": {
return "json";
}
case "multipart/form-data": {
return "multipart-form";
}
case "text/html": {
return "html";
}
default: {
return;
}
}
};
exports.getEncoding = getEncoding;