Harden HTML5 SSE headers
This commit is contained in:
@@ -167,6 +167,9 @@ def test_html5_server_rendered_project_editor(tmp_path: Path):
|
||||
assert "__next" not in editor.text
|
||||
|
||||
with client.stream("GET", f"/html5/projects/{project_id}/events?once=1") as events:
|
||||
assert events.headers["cache-control"] == "no-cache, no-transform"
|
||||
assert events.headers["x-accel-buffering"] == "no"
|
||||
assert events.headers["connection"] == "keep-alive"
|
||||
first_chunk = "".join(events.iter_text())
|
||||
assert ": project " in first_chunk
|
||||
assert "retry: 5000" in first_chunk
|
||||
@@ -708,6 +711,9 @@ def test_html5_project_setup_renders_server_fragments():
|
||||
assert "<html" not in summary.text
|
||||
|
||||
with client.stream("GET", f"/html5/projects/{project_id}/setup/events?once=1") as events:
|
||||
assert events.headers["cache-control"] == "no-cache, no-transform"
|
||||
assert events.headers["x-accel-buffering"] == "no"
|
||||
assert events.headers["connection"] == "keep-alive"
|
||||
first_chunk = "".join(events.iter_text())
|
||||
assert ": setup " in first_chunk
|
||||
assert "retry: 5000" in first_chunk
|
||||
@@ -747,6 +753,9 @@ def test_html5_operations_renders_job_monitor_fragments():
|
||||
assert "__next" not in page.text
|
||||
|
||||
with client.stream("GET", "/html5/operations/events?once=1") as events:
|
||||
assert events.headers["cache-control"] == "no-cache, no-transform"
|
||||
assert events.headers["x-accel-buffering"] == "no"
|
||||
assert events.headers["connection"] == "keep-alive"
|
||||
first_chunk = "".join(events.iter_text())
|
||||
assert ": operations heartbeat" in first_chunk
|
||||
assert "retry: 5000" in first_chunk
|
||||
|
||||
Reference in New Issue
Block a user