diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-05-07 21:28:22 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-05-07 21:28:22 +0000 |
commit | 3dfcefb494c13da48548e6ec13bf400a5504145a (patch) | |
tree | 7f02b8f447583c792f307c75801bbaf87ba30ea3 | |
parent | b8c16478d37f36913ea98fa37d9a2751263c1acc (diff) | |
parent | 0ebd29371a9083a9ea050d6574a842a290992788 (diff) | |
download | zuul-3dfcefb494c13da48548e6ec13bf400a5504145a.tar.gz |
Merge "web: Allow clients (browsers, proxies) to cache status.json"
-rwxr-xr-x | tests/test_scheduler.py | 3 | ||||
-rw-r--r-- | zuul/webapp.py | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py index 21fb04c84..c872b23d9 100755 --- a/tests/test_scheduler.py +++ b/tests/test_scheduler.py @@ -2118,7 +2118,10 @@ class TestScheduler(ZuulTestCase): self.assertIn('Content-Type', headers) self.assertEqual(headers['Content-Type'], 'application/json; charset=UTF-8') + self.assertIn('Access-Control-Allow-Origin', headers) + self.assertIn('Cache-Control', headers) self.assertIn('Last-Modified', headers) + self.assertIn('Expires', headers) data = f.read() self.worker.hold_jobs_in_build = False diff --git a/zuul/webapp.py b/zuul/webapp.py index e289398ac..44c333bf9 100644 --- a/zuul/webapp.py +++ b/zuul/webapp.py @@ -121,5 +121,10 @@ class WebApp(threading.Thread): raise webob.exc.HTTPNotFound() response.headers['Access-Control-Allow-Origin'] = '*' + + response.cache_control.public = True + response.cache_control.max_age = self.cache_expiry response.last_modified = self.cache_time - return response + response.expires = self.cache_time + self.cache_expiry + + return response.conditional_response_app |