Skip to content

Commit e9882b3

Browse files
author
Olga Kopylova
committed
Merge remote-tracking branch 'origin/MAGETWO-39576-Profiler-JSON' into PR_Branch
2 parents daa65ab + f661677 commit e9882b3

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

app/bootstrap.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,15 @@
3131
require_once __DIR__ . '/autoload.php';
3232
require_once BP . '/app/functions.php';
3333

34-
if (!empty($_SERVER['MAGE_PROFILER'])) {
35-
\Magento\Framework\Profiler::applyConfig($_SERVER['MAGE_PROFILER'], BP, !empty($_REQUEST['isAjax']));
34+
if (!empty($_SERVER['MAGE_PROFILER'])
35+
&& isset($_SERVER['HTTP_ACCEPT'])
36+
&& strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false
37+
) {
38+
\Magento\Framework\Profiler::applyConfig(
39+
$_SERVER['MAGE_PROFILER'],
40+
BP,
41+
!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'
42+
);
3643
}
3744
if (ini_get('date.timezone') == '') {
3845
date_default_timezone_set('UTC');

app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,6 @@ public function aroundDispatch(
7676
$this->kernel->process($result);
7777
}
7878
} else {
79-
json_decode($result->getContent());
80-
if (json_last_error() == JSON_ERROR_NONE) {
81-
// reset profiler to avoid appending profiling stat to JSON response
82-
\Magento\Framework\Profiler::reset();
83-
}
8479
$this->addDebugHeader($result, 'X-Magento-Cache-Debug', 'HIT', true);
8580
}
8681
return $result;

app/code/Magento/PageCache/Test/Unit/Model/App/FrontController/BuiltinPluginTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ public function testAroundDispatchReturnsCache($state)
200200
$this->responseMock->expects($this->never())
201201
->method('setHeader');
202202
}
203-
$this->responseMock->expects($this->once())->method('getContent');
204203
$this->assertSame(
205204
$this->responseMock,
206205
$this->plugin->aroundDispatch($this->frontControllerMock, $this->closure, $this->requestMock)

lib/internal/Magento/Framework/Controller/Result/Json.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ public function setJsonData($jsonData)
6363
*/
6464
protected function render(ResponseInterface $response)
6565
{
66-
// reset profiler to avoid appending profiling stat to JSON response
67-
\Magento\Framework\Profiler::reset();
6866
$this->translateInline->processResponseBody($this->json, true);
6967
$response->representJson($this->json);
7068
return $this;

0 commit comments

Comments
 (0)