Update to fix style errors to pass pep8 checks. Change-Id: If27182ad18e52aa9e7fe5ac8d48db52dacbbf0f3 Closes-bug: #1631536
15 lines
567 B
Python
15 lines
567 B
Python
from pecan.hooks import PecanHook
|
|
|
|
|
|
class CORSHook(PecanHook):
|
|
|
|
def after(self, state):
|
|
state.response.headers['Access-Control-Allow-Origin'] = '*'
|
|
state.response.headers['Access-Control-Allow-Methods'] = (
|
|
'GET, POST, DELETE, PUT, LIST, OPTIONS')
|
|
state.response.headers['Access-Control-Allow-Headers'] = (
|
|
'origin, authorization, content-type, accept')
|
|
if not state.response.headers['Content-Length']:
|
|
state.response.headers['Content-Length'] = (
|
|
str(len(state.response.body)))
|