move content-type test and add render_template