DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (c68fe15a81fc)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
import os
import time

def main(request, response):
def main(request, response):
  """Serves the contents in blue.png but with a Cache-Control header.

  Emits a Cache-Control header with max-age set to 1h to allow the browser
  cache the image. Used for testing behaviors involving caching logics.
  image_path = os.path.join(os.path.dirname(__file__), "blue.png")
  response.headers.set("Cache-Control", "max-age=3600")
  response.headers.set("Content-Type", "image/png")
  response.content = open(image_path, mode='rb').read()