summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/eventsource/resources/last-event-id.py
blob: 4306fbaa3f16087d93b66bbbd137dbd4cb33af79 (plain)
1
2
3
4
5
6
7
8
9
10
11
 # -*- coding: utf-8 -*-

def main(request, response):
  response.headers.set("Content-Type", "text/event-stream")
  last_event_id = request.headers.get('Last-Event-ID', None)

  if(last_event_id):
      return "data: " + last_event_id + "\n\n"
  else:
    return "id: …\nretry: 200\ndata: hello\n\n"