Bug 1735858 [wpt PR 31247] - App history: make it mostly nonfunctional for opaque...
[gecko.git] / testing / web-platform / tests / images / blue-png-cachable.py
blob6d8556542ab50d3e8c9dc163ddd2e41bec8f774e
1 import os
2 from wptserve.utils import isomorphic_decode
4 def main(request, response):
5 """Serves the contents in blue.png but with a Cache-Control header.
7 Emits a Cache-Control header with max-age set to 1h to allow the browser
8 cache the image. Used for testing behaviors involving caching logics.
9 """
10 image_path = os.path.join(os.path.dirname(isomorphic_decode(__file__)), u"blue.png")
11 response.headers.set(b"Cache-Control", b"max-age=3600")
12 response.headers.set(b"Content-Type", b"image/png")
13 response.content = open(image_path, mode='rb').read()