8 lines
298 B
Python
8 lines
298 B
Python
from flask import request, jsonify
|
|
|
|
|
|
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 jsonify({"message": "Invalid request parameters"}), 400
|