better checking for mimetype to determin html or json response