This commit is contained in:
Tykayn 2025-09-15 23:25:11 +02:00 committed by tykayn
parent 656c3fd414
commit 1c17b57d8a
37 changed files with 2818 additions and 469 deletions

View 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')