Skip to content

Commit 9d18f1c

Browse files
4513nicolas-grekas
authored andcommitted
[HttpFoundation] Fix Expires response header for EventStream
1 parent c0a2415 commit 9d18f1c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

EventStreamResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(?callable $callback = null, int $status = 200, array
4848
'Cache-Control' => 'private, no-cache, no-store, must-revalidate, max-age=0',
4949
'X-Accel-Buffering' => 'no',
5050
'Pragma' => 'no-cache',
51-
'Expire' => '0',
51+
'Expires' => '0',
5252
];
5353

5454
parent::__construct($callback, $status, $headers);

Tests/EventStreamResponseTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ public function testInitializationWithDefaultValues()
2929
$this->assertNull($response->getRetry());
3030
}
3131

32+
public function testPresentOfExpiresHeader()
33+
{
34+
$response = new EventStreamResponse();
35+
36+
$this->assertTrue($response->headers->has('Expires'));
37+
$this->assertSame('0', $response->headers->get('Expires'));
38+
}
39+
3240
public function testStreamSingleEvent()
3341
{
3442
$response = new EventStreamResponse(function () {

0 commit comments

Comments
 (0)