Skip to content

Commit 7016057

Browse files
Toflarderrabus
authored andcommitted
[HttpFoundation] Fixed type mismatch
1 parent 31d4a64 commit 7016057

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public function prepare(Request $request)
311311
}
312312

313313
// Check if we need to send extra expire info headers
314-
if ('1.0' == $this->getProtocolVersion() && str_contains($headers->get('Cache-Control'), 'no-cache')) {
314+
if ('1.0' == $this->getProtocolVersion() && str_contains($headers->get('Cache-Control', ''), 'no-cache')) {
315315
$headers->set('pragma', 'no-cache');
316316
$headers->set('expires', -1);
317317
}

Tests/ResponseTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,12 @@ public function testPrepareSetsPragmaOnHttp10Only()
578578
$this->assertEquals('no-cache', $response->headers->get('pragma'));
579579
$this->assertEquals('-1', $response->headers->get('expires'));
580580

581+
$response = new Response('foo');
582+
$response->headers->remove('cache-control');
583+
$response->prepare($request);
584+
$this->assertFalse($response->headers->has('pragma'));
585+
$this->assertFalse($response->headers->has('expires'));
586+
581587
$request->server->set('SERVER_PROTOCOL', 'HTTP/1.1');
582588
$response = new Response('foo');
583589
$response->prepare($request);

0 commit comments

Comments
 (0)