Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
Added editorutils file with a utility function to convert mimetype to editor modes
Andrew Bastin5936a06ad18e
diff --git a/functions/editorutils.js b/functions/editorutils.jsnew file mode 100644index 000000000..c8e14a5f9--- /dev/null+++ b/functions/editorutils.js@@ -0,0 +1,11 @@+const mimeToMode = {+ "text/plain": "plain_text",+ "text/html": "html",+ "application/xml": "xml",+ "application/hal+json": "json",+ "application/json": "json"+}++export function getEditorLangForMimeType(mimeType) {+ return mimeToMode[mimeType] || "plain_text";+}