up stuff
This commit is contained in:
parent
656c3fd414
commit
1c17b57d8a
37 changed files with 2818 additions and 469 deletions
27
oedb/middleware/headers.py
Normal file
27
oedb/middleware/headers.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
"""
|
||||
Middleware components for the OpenEventDatabase.
|
||||
"""
|
||||
|
||||
from oedb.utils.logging import logger
|
||||
|
||||
class HeaderMiddleware:
|
||||
"""
|
||||
Middleware that adds standard headers to all responses.
|
||||
"""
|
||||
|
||||
def process_response(self, req, resp, resource, params):
|
||||
"""
|
||||
Add standard headers to the response.
|
||||
|
||||
Args:
|
||||
req: The request object.
|
||||
resp: The response object.
|
||||
resource: The resource object.
|
||||
params: The request parameters.
|
||||
"""
|
||||
logger.debug("Adding standard headers to response")
|
||||
resp.set_header('X-Powered-By', 'OpenEventDatabase')
|
||||
resp.set_header('Access-Control-Allow-Origin', '*')
|
||||
resp.set_header('Access-Control-Allow-Headers', 'X-Requested-With')
|
||||
resp.set_header('Access-Control-Allow-Headers', 'Content-Type')
|
||||
resp.set_header('Access-Control-Allow-Methods','GET, POST, PUT, DELETE, OPTIONS')
|
Loading…
Add table
Add a link
Reference in a new issue