Skip to content

Commit 64368a7

Browse files
committed
ACP2E-1627: [Cloud] Magento Product Recommendation/Data Services Causing File Download Warning
1 parent 438bcf6 commit 64368a7

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

lib/internal/Magento/Framework/App/Response/File.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ public function getHeader($name)
152152
*/
153153
public function clearHeader($name)
154154
{
155-
return $this->response->clearHeader($name);
155+
$this->response->clearHeader($name);
156+
return $this;
156157
}
157158
}

lib/internal/Magento/Framework/App/Test/Unit/Response/FileTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,36 @@ public function testSendResponseWithRemoveOption(): void
266266
$this->getModel($options)->sendResponse();
267267
}
268268

269+
public function testSetHeader(): void
270+
{
271+
$model = $this->getModel();
272+
$this->responseMock->expects($this->once())
273+
->method('setHeader')
274+
->with('Content-type', 1024, true)
275+
->willReturnSelf();
276+
$this->assertSame($model, $model->setHeader('Content-type', 1024, true));
277+
}
278+
279+
public function testGetHeader(): void
280+
{
281+
$model = $this->getModel();
282+
$this->responseMock->expects($this->once())
283+
->method('getHeader')
284+
->with('Content-type')
285+
->willReturn(2048);
286+
$this->assertEquals(2048, $model->getHeader('Content-type'));
287+
}
288+
289+
public function testClearHeader(): void
290+
{
291+
$model = $this->getModel();
292+
$this->responseMock->expects($this->once())
293+
->method('clearHeader')
294+
->with('Content-type')
295+
->willReturnSelf();
296+
$this->assertSame($model, $model->clearHeader('Content-type'));
297+
}
298+
269299
private function getModel(array $options = []): File
270300
{
271301
return new File(

0 commit comments

Comments
 (0)