Return CORS headers on all requests
The Access-Control-Allow-Origin needs to be returned with '*' for all of our API methods. (it's a public api) Add it to the base gearman_request class so that we're returning it on all the calls. (the tenants route was missing it) Change-Id: I78a4787e5045ab4e026a7b03c555b020f4772c5c
This commit is contained in:
parent
632ecdefa3
commit
3046aa6350
|
@ -177,7 +177,6 @@ class GearmanHandler(object):
|
|||
if result_filter:
|
||||
payload = result_filter.filterPayload(payload)
|
||||
resp = web.json_response(payload)
|
||||
resp.headers['Access-Control-Allow-Origin'] = '*'
|
||||
resp.headers["Cache-Control"] = "public, max-age=%d" % \
|
||||
self.cache_expiry
|
||||
resp.last_modified = self.cache_time[tenant]
|
||||
|
@ -186,9 +185,7 @@ class GearmanHandler(object):
|
|||
async def job_list(self, request, result_filter=None):
|
||||
tenant = request.match_info["tenant"]
|
||||
job = self.rpc.submitJob('zuul:job_list', {'tenant': tenant})
|
||||
resp = web.json_response(json.loads(job.data[0]))
|
||||
resp.headers['Access-Control-Allow-Origin'] = '*'
|
||||
return resp
|
||||
return web.json_response(json.loads(job.data[0]))
|
||||
|
||||
async def key_get(self, request, result_filter=None):
|
||||
tenant = request.match_info["tenant"]
|
||||
|
@ -201,6 +198,7 @@ class GearmanHandler(object):
|
|||
resp = None
|
||||
try:
|
||||
resp = await self.controllers[action](request, result_filter)
|
||||
resp.headers['Access-Control-Allow-Origin'] = '*'
|
||||
except asyncio.CancelledError:
|
||||
self.log.debug("request handling cancelled")
|
||||
except Exception as e:
|
||||
|
|
Loading…
Reference in New Issue