Bug 1615198 [wpt PR 21773] - Remove tentative from lazy load tests, a=testonly
[gecko.git] / testing / web-platform / tests / html / semantics / embedded-content / the-img-element / resources / referrer-checker-img.py
blob0597268d8391b339c80d3274a52265db168e676a
1 import os
3 # Returns a valid image response when request's |referrer| matches
4 # |expected_referrer|.
5 def main(request, response):
6 referrer = request.headers.get("referer", "")
7 expected_referrer = request.GET.first("expected_referrer", "")
8 response_headers = [("Content-Type", "image/png")]
9 if referrer == expected_referrer:
10 image_path = os.path.join(os.path.dirname(__file__), "image.png")
11 return (200, response_headers, open(image_path, mode='rb').read())
12 return (404, response_headers, "Not found")