From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../tests/eventsource/resources/last-event-id2.py | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 testing/web-platform/tests/eventsource/resources/last-event-id2.py (limited to 'testing/web-platform/tests/eventsource/resources/last-event-id2.py') diff --git a/testing/web-platform/tests/eventsource/resources/last-event-id2.py b/testing/web-platform/tests/eventsource/resources/last-event-id2.py new file mode 100644 index 0000000000..4f133d707d --- /dev/null +++ b/testing/web-platform/tests/eventsource/resources/last-event-id2.py @@ -0,0 +1,23 @@ +ID_PERSISTS = 1 +ID_RESETS_1 = 2 +ID_RESETS_2 = 3 + +def main(request, response): + response.headers.set(b"Content-Type", b"text/event-stream") + try: + test_type = int(request.GET.first(b"type", ID_PERSISTS)) + except: + test_type = ID_PERSISTS + + if test_type == ID_PERSISTS: + return b"id: 1\ndata: 1\n\ndata: 2\n\nid: 2\ndata:3\n\ndata:4\n\n" + + elif test_type == ID_RESETS_1: + return b"id: 1\ndata: 1\n\nid:\ndata:2\n\ndata:3\n\n" + + # empty id field without colon character (:) should also reset + elif test_type == ID_RESETS_2: + return b"id: 1\ndata: 1\n\nid\ndata:2\n\ndata:3\n\n" + + else: + return b"data: invalid_test\n\n" -- cgit v1.2.3