Only set contentType header if type is JSON