Setting MIME Types for yoru response output
At Docly, we constantly strive to offer features that make the web development process efficient and hassle-free. Today, we want to discuss how to set the media type (MIME) for your output response.
Understanding MIME Types
MIME types are a way of telling browsers what kind of data a particular piece of content represents. In simpler terms, it helps the browser understand how to process the incoming data. For example, if you have a 'text/html' MIME type, the browser knows that it should interpret the incoming data as HTML.
Setting MIME Types in Docly
To set a specific content-type header for your output response in Docly, you can use the #setmime() command. This command instructs the Docly engine to use the specified MIME type when rendering the page.
For instance, if you want to set the MIME type of your response to 'text/html', you can use the following command:
#docly.setMime("text/html")#
When using API functions
To return byte output with other mime types than JSON from your API (the #/API folder), note that you need to use this function as well:
https://developers.docly.net/JavaScript/Output-functions/SetContentDisposition
See more examples here:
https://developers.docly.net/JavaScript/Output-functions/SetMime