Use correct HTTP error codes
This commit is contained in:
parent
105bbd3e96
commit
031ed358f1
@ -40,12 +40,12 @@ def create_product_listing():
|
|||||||
price = request.json.get('price')
|
price = request.json.get('price')
|
||||||
|
|
||||||
if name is None or price is None:
|
if name is None or price is None:
|
||||||
return abort(401)
|
return abort(400)
|
||||||
|
|
||||||
float_price = float(price)
|
float_price = float(price)
|
||||||
|
|
||||||
if not isinstance(float_price, float):
|
if not isinstance(float_price, float):
|
||||||
return abort(401)
|
return abort(400)
|
||||||
|
|
||||||
result, status_code = ProductService.create_listing(user_id, name, float_price)
|
result, status_code = ProductService.create_listing(user_id, name, float_price)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user