diff --git a/api/categories.py b/api/categories.py index 402171b..f8e7468 100644 --- a/api/categories.py +++ b/api/categories.py @@ -5,7 +5,7 @@ from flask import Blueprint # Создаем blueprint для API api_category = Blueprint('api_category', __name__, url_prefix='/categories') -@api_category.route('/', methods=['GET']) +@api_category.route('/', methods=['GET'], strict_slashes=False) def get_categories(): """ Получение всех категорий с атрибутами @@ -17,7 +17,7 @@ def get_categories(): except Exception as e: return jsonify({"error": str(e)}), 500 -@api_category.route('/', methods=['GET']) +@api_category.route('/', methods=['GET'], strict_slashes=False) def get_category(category_id): """ Получение категории по ID diff --git a/api/email.py b/api/email.py index 7b57377..64484c1 100644 --- a/api/email.py +++ b/api/email.py @@ -5,7 +5,7 @@ from flask import Blueprint # Создаем blueprint для API api_email = Blueprint('api_email', __name__, url_prefix='/email') -@api_email.route('/', methods=['POST']) +@api_email.route('/', methods=['POST'], strict_slashes=False) def post_email(): if not request.is_json: return jsonify({"error": "Content-Type must be application/json"}), 400 diff --git a/api/product.py b/api/product.py index 7cc1b22..80f1ea2 100644 --- a/api/product.py +++ b/api/product.py @@ -5,7 +5,7 @@ from flask import Blueprint # Создаем blueprint для API api_product = Blueprint('api_product', __name__, url_prefix='/products') -@api_product.route('/', methods=['GET']) +@api_product.route('/', methods=['GET'], strict_slashes=False) def get_products(): """ Получение товаров с фильтрацией и пагинацией @@ -51,7 +51,7 @@ def get_products(): except Exception as e: return jsonify({"error": str(e)}), 500 -@api_product.route('/', methods=['GET']) +@api_product.route('/', methods=['GET'], strict_slashes=False) def get_product(product_id): """ Получение товара по ID @@ -65,7 +65,7 @@ def get_product(product_id): except Exception as e: return jsonify({"error": str(e)}), 500 -@api_product.route('/fetchById', methods=['GET']) +@api_product.route('/fetchById', methods=['GET'], strict_slashes=False) def get_product_by_id_param(): """ Альтернативный маршрут для получения товара через query параметр diff --git a/app.py b/app.py index e7a9510..49174fd 100644 --- a/app.py +++ b/app.py @@ -7,6 +7,7 @@ from utils.loadDotENV import initializeENV from api.categories import api_category from api.product import api_product from api.email import api_email +from werkzeug.middleware.proxy_fix import ProxyFix # Инициализация initializeENV() @@ -22,6 +23,8 @@ app.register_blueprint(api_category) app.register_blueprint(api_product) app.register_blueprint(api_email) +app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1, x_host=1) + @app.route('/health', methods=['GET']) def health_check(): """Проверка работоспособности API"""