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.
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()