From b8301081f5674ce6689773f34d9f1a23271ac504 Mon Sep 17 00:00:00 2001 From: MiBo Date: Mon, 24 Nov 2025 18:37:51 +0100 Subject: [PATCH] [HttpFoundation] Fix Expires response header for EventStream --- .../Component/HttpFoundation/EventStreamResponse.php | 2 +- .../HttpFoundation/Tests/EventStreamResponseTest.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/EventStreamResponse.php b/src/Symfony/Component/HttpFoundation/EventStreamResponse.php index fe1a2872e0371..e739c309c8fd8 100644 --- a/src/Symfony/Component/HttpFoundation/EventStreamResponse.php +++ b/src/Symfony/Component/HttpFoundation/EventStreamResponse.php @@ -48,7 +48,7 @@ public function __construct(?callable $callback = null, int $status = 200, array 'Cache-Control' => 'private, no-cache, no-store, must-revalidate, max-age=0', 'X-Accel-Buffering' => 'no', 'Pragma' => 'no-cache', - 'Expire' => '0', + 'Expires' => '0', ]; parent::__construct($callback, $status, $headers); diff --git a/src/Symfony/Component/HttpFoundation/Tests/EventStreamResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/EventStreamResponseTest.php index f3b5ae9105370..a941bc40ec727 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/EventStreamResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/EventStreamResponseTest.php @@ -29,6 +29,14 @@ public function testInitializationWithDefaultValues() $this->assertNull($response->getRetry()); } + public function testPresentOfExpiresHeader() + { + $response = new EventStreamResponse(); + + $this->assertTrue($response->headers->has('Expires')); + $this->assertSame('0', $response->headers->get('Expires')); + } + public function testStreamSingleEvent() { $response = new EventStreamResponse(function () {