Files
digifi-BankEmulator/app/middlewares/cors.py
T
2025-03-21 12:12:20 +01:00

9 lines
359 B
Python

from flask import request
from app.helpers.response_helper import ResponseHelper
def enforce_json():
"""Middleware to enforce JSON Content-Type for incoming requests"""
if request.method in ["POST", "PUT", "PATCH"] and request.content_type != "application/json":
return ResponseHelper.error( message="Content-Type must be application/json")