Set Last-Modified header when serving status.json
Apache won't cache anything without a Last-Modified header. Be a good citizen and set the Last-Modified header when serving status.json data. Set the value to the cache_time timestamp. Update the status checking test to make sure that this and other headers are properly present so that this does not regress. Change-Id: I2215d9c9694bd9ef7b94f29f654da77ae85a9959
This commit is contained in:
parent
9601f6463c
commit
aa4f2e7a3a
|
@ -1937,6 +1937,12 @@ class TestScheduler(ZuulTestCase):
|
|||
|
||||
req = urllib2.Request("http://localhost:%s/status.json" % port)
|
||||
f = urllib2.urlopen(req)
|
||||
headers = f.info()
|
||||
self.assertIn('Content-Length', headers)
|
||||
self.assertIn('Content-Type', headers)
|
||||
self.assertEqual(headers['Content-Type'],
|
||||
'application/json; charset=UTF-8')
|
||||
self.assertIn('Last-Modified', headers)
|
||||
data = f.read()
|
||||
|
||||
self.worker.hold_jobs_in_build = False
|
||||
|
|
|
@ -57,4 +57,5 @@ class WebApp(threading.Thread):
|
|||
response = webob.Response(body=self.cache,
|
||||
content_type='application/json')
|
||||
response.headers['Access-Control-Allow-Origin'] = '*'
|
||||
response.last_modified = self.cache_time
|
||||
return response
|
||||
|
|
Loading…
Reference in New Issue