Correct Last-Modified header for status API
Currently, the Last-Modified header is returned as a UNIX timestamp, whereas according to RFC 7232, it should be in a human-readable date format. Comply with the RFC. Change-Id: Id12482750e556809e731db6b3bb09d89234bac63
This commit is contained in:
parent
9de2442b87
commit
efc2ab972e
|
@ -109,6 +109,7 @@ class TestWeb(BaseTestWeb):
|
|||
self.assertIn('Access-Control-Allow-Origin', resp.headers)
|
||||
self.assertIn('Cache-Control', resp.headers)
|
||||
self.assertIn('Last-Modified', resp.headers)
|
||||
self.assertTrue(resp.headers['Last-Modified'].endswith(' GMT'))
|
||||
|
||||
self.executor_server.hold_jobs_in_build = False
|
||||
self.executor_server.release()
|
||||
|
|
|
@ -21,6 +21,7 @@ from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool
|
|||
from ws4py.websocket import WebSocket
|
||||
import codecs
|
||||
import copy
|
||||
from datetime import datetime
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
|
@ -245,7 +246,9 @@ class ZuulWebAPI(object):
|
|||
resp = cherrypy.response
|
||||
resp.headers["Cache-Control"] = "public, max-age=%d" % \
|
||||
self.cache_expiry
|
||||
resp.headers["Last-modified"] = self.cache_time[tenant]
|
||||
last_modified = datetime.utcfromtimestamp(self.cache_time[tenant])
|
||||
last_modified_header = last_modified.strftime('%a, %d %b %Y %X GMT')
|
||||
resp.headers["Last-modified"] = last_modified_header
|
||||
resp.headers['Access-Control-Allow-Origin'] = '*'
|
||||
return payload
|
||||
|
||||
|
|
Loading…
Reference in New Issue