@@ -17,7 +17,6 @@ def test_sse_basic_headers(session):
1717 # Accept either clean optimized headers or legacy compatibility
1818 cache_control = response .headers .get ("Cache-Control" )
1919 assert cache_control in ["no-cache, no-store, must-revalidate" , "no-cache, no-cache, no-store, must-revalidate" ]
20- assert "Access-Control-Allow-Origin" in response .headers
2120
2221
2322@pytest .mark .benchmark
@@ -196,13 +195,17 @@ def test_sse_empty_stream(session):
196195
197196@pytest .mark .benchmark
198197def test_sse_custom_headers (session ):
199- """Test SSE endpoint with custom headers"""
198+ """Test SSE endpoint with custom headers; SSE responses should not include default CORS headers for cross-origin EventSource support """
200199 response = requests .get (f"{ BASE_URL } /sse/with_headers" , stream = True )
201200
202201 assert response .status_code == 200
203202 assert response .headers .get ("X-Custom-Header" ) == "custom-value"
204203 assert response .headers .get ("Content-Type" ) == "text/event-stream"
205204
205+ # SSE responses should not include default CORS headers
206+ assert response .headers .get ("Access-Control-Allow-Origin" ) is None
207+ assert response .headers .get ("Access-Control-Allow-Headers" ) is None
208+
206209
207210@pytest .mark .benchmark
208211def test_sse_custom_status_code (session ):
@@ -409,7 +412,6 @@ def test_sse_optimization_headers(session):
409412 assert response .headers .get ("Pragma" ) == "no-cache"
410413 assert response .headers .get ("Expires" ) == "0"
411414 assert response .headers .get ("X-Accel-Buffering" ) == "no" # Nginx buffering disabled
412- assert response .headers .get ("Access-Control-Allow-Origin" ) == "*"
413415 # Connection header might be managed by underlying HTTP infrastructure
414416 connection = response .headers .get ("Connection" )
415417 assert connection is None or connection == "keep-alive"
0 commit comments