Add better support for getting mimetype and sending headers