699249b6ba92f1ff68ba88498c0d02e7d65031f1
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / resource-timing / resources / rt-revalidation-response.py
1 def main(request, response):
2     response.headers.set("Access-Control-Allow-Origin", "*")
3     response.headers.set("Access-Control-Allow-Headers", "If-Modified-Since")
4
5     # Just return 304 for any request with If-Modified-Since.
6     modifiedSince = request.headers.get("If-Modified-Since", None)
7     if modifiedSince is not None:
8         response.status = (304, "Not Modified")
9         return ""
10
11     # Otherwise return content from parameters.
12     content = request.GET.first("content", None)
13     mime = request.GET.first("mime", "text/plain")
14     date = request.GET.first("date", None)
15     tao = request.GET.first("tao", None)
16
17     if tao == "true":
18         response.headers.set("Timing-Allow-Origin", "*")
19     response.headers.set("Last-Modified", date)
20     response.status = (200, "OK")
21     response.headers.set("Content-Type", mime)
22     return content