How do I set mime-types for Craft templates? For example, if I'd like to serve a file as application/json or application/rss+xml

I see in the RSS Feed documentation that it mentions saving a file with .rss will auto-detect and serve the correct mime-type. 

However, how is this detected? Is there a set list that the CMS uses based on the extension or is it derived from the server in some way?
If you want to explicitly set the mime type from your template, you can do it with Craft's {% header %} tag:

{% header "Content-Type: application/json" %}


If it is already set via this method, Craft will go with it and not attempt to auto-detect/set the mime-type on it's own.