diff options
Diffstat (limited to 'httpcache/httpcache/tests/server.py')
-rw-r--r-- | httpcache/httpcache/tests/server.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/httpcache/httpcache/tests/server.py b/httpcache/httpcache/tests/server.py new file mode 100644 index 00000000..140c3f1d --- /dev/null +++ b/httpcache/httpcache/tests/server.py @@ -0,0 +1,36 @@ +from __future__ import print_function +import cherrypy + + +class CacheTestingServer(object): + + def index(self): + return 'foo' + index.exposed = True + + def max_age(self, value=None): + age = 'max-age=%s' % (value or 300) + cherrypy.response.headers['Cache-Control'] = age + return 'max age' + max_age.exposed = True + + def no_cache(self): + cherrypy.response.headers['Cache-Control'] = 'no-cache' + return 'no cache' + no_cache.exposed = True + + def must_revalidate(self): + cherrypy.response.headers['Cache-Control'] = 'must-revalidate' + return 'must revalidate' + must_revalidate.exposed = True + + def no_store(self): + cherrypy.response.headers['Cache-Control'] = 'no-store' + return 'no store' + no_store.exposed = True + + +if __name__ == '__main__': + cherrypy.tree.mount(CacheTestingServer(), '/') + cherrypy.engine.start() + cherrypy.engine.block() |