Made template function more robust
Made template function more robust

Previously no header for content type was set.
This meant that sometimes the contents would be parsed as HTML
by the web browser by sometimes the contents would be parsed as text.

coursestitch/coursestitch-api