Prechádzať zdrojové kódy

repair bug & use app.route(...)

kunickyd 3 rokov pred
rodič
commit
b4d333aaa7
1 zmenil súbory, kde vykonal 3 pridanie a 3 odobranie
  1. 3 3
      app.py

+ 3 - 3
app.py

@@ -65,7 +65,7 @@ transferAssetsValidationErrors = [
     StatefulValidationError("Too long description", "Too long description", "Ensure that description length matches the criteria above (or just shorten it)")
 ]    
 
-@app.get("/accounts/<string:accountId>/assets/")
+@app.route("/accounts/<string:accountId>/assets/", methods=['GET'])
 def get_account_assets(accountId): #TODO: add validation and error handling
 
     query = iroha.query('GetAccountAssets', account_id=accountId)
@@ -85,11 +85,11 @@ def get_account_assets(accountId): #TODO: add validation and error handling
 
     return jsonify(response)
 
-@app.post("/assets/transfer/")
+@app.route("/assets/transfer/", methods=['POST'])
 def transfer_assets():
     data = request.get_json()
 
-    if data["transfers"] and len(data["transfers"]) > 1:
+    if data["transfers"] and len(data["transfers"]) > 0:
         commands = []
 
         for transfer in data["transfers"]: