UNPKG

masto

Version:

Mastodon API client for JavaScript, TypeScript, Node.js, browsers

18 lines (17 loc) 426 B
export 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"; } default: { return; } } };