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")