diff --git a/core/modules/rest/src/Plugin/views/display/RestExport.php b/core/modules/rest/src/Plugin/views/display/RestExport.php index 1eba5a9..b2b1700 100644 --- a/core/modules/rest/src/Plugin/views/display/RestExport.php +++ b/core/modules/rest/src/Plugin/views/display/RestExport.php @@ -115,6 +115,12 @@ public function initDisplay(ViewExecutable $view, array &$display, array &$optio if ($request_content_type != 'html') { $this->setContentType($request_content_type); } + // If the requested content type is 'html' and we only have 1 format option + // selected in the view display options, set that as the default content + // type. + elseif (isset($options['style']['options']['formats']) && count($options['style']['options']['formats']) == 1) { + $this->setContentType(reset($options['style']['options']['formats'])); + } $this->setMimeType($this->view->getRequest()->getMimeType($this->contentType)); }