From 0553ebc06c8c1dadadb67ae08a29a922cfa5719d Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Sat, 18 Nov 2017 14:40:46 +0200 Subject: [PATCH] Backport of MAGETWO-84006 for Magento 2.1: Fix robots.txt content type to 'text/plain' #12310 (cherry picked from commit 2c3cd64b7b5aad670ca0eaac06112833a4a85437) --- app/code/Magento/Robots/Controller/Index/Index.php | 1 + .../Magento/Robots/Test/Unit/Controller/Index/IndexTest.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/code/Magento/Robots/Controller/Index/Index.php b/app/code/Magento/Robots/Controller/Index/Index.php index b94626e93432d..679066d723dce 100644 --- a/app/code/Magento/Robots/Controller/Index/Index.php +++ b/app/code/Magento/Robots/Controller/Index/Index.php @@ -43,6 +43,7 @@ public function execute() /** @var Page $resultPage */ $resultPage = $this->resultPageFactory->create(true); $resultPage->addHandle('robots_index_index'); + $resultPage->setHeader('Content-Type', 'text/plain'); return $resultPage; } } diff --git a/app/code/Magento/Robots/Test/Unit/Controller/Index/IndexTest.php b/app/code/Magento/Robots/Test/Unit/Controller/Index/IndexTest.php index aaac511e3c521..3ebf1d05325c5 100644 --- a/app/code/Magento/Robots/Test/Unit/Controller/Index/IndexTest.php +++ b/app/code/Magento/Robots/Test/Unit/Controller/Index/IndexTest.php @@ -51,6 +51,9 @@ public function testExecute() $resultPageMock->expects($this->once()) ->method('addHandle') ->with('robots_index_index'); + $resultPageMock->expects($this->once()) + ->method('setHeader') + ->with('Content-Type', 'text/plain'); $this->resultPageFactory->expects($this->any()) ->method('create')