Avoiding error when header[:content_type] is nil and would cause a method missing exception when calling main_type