fix(api): fix http respons and bad way
This commit is contained in:
1 parent
13fcc233ff
commit
0dc9034f19
4 files changed
+9
-6
No files matched your search
+3
-3
@@ -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('/<int:product_id>', methods=['GET'])
|
||||
@api_product.route('/<int:product_id>', 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 параметр
|
||||
|
||||
Reference in new issue
Block a user