Fix: send {} body for POST, not None, v1.0.33
This commit is contained in:
@@ -19,7 +19,7 @@ class HttpClient:
|
|||||||
def post(self, path, data=None, **kwargs):
|
def post(self, path, data=None, **kwargs):
|
||||||
kwargs.setdefault("timeout", 30)
|
kwargs.setdefault("timeout", 30)
|
||||||
url = f"{self._endpoint}{path}"
|
url = f"{self._endpoint}{path}"
|
||||||
r = self._session.post(url, json=data, **kwargs)
|
r = self._session.post(url, json=(data if data is not None else {}), **kwargs)
|
||||||
if not r.ok:
|
if not r.ok:
|
||||||
raise Exception(f"POST {path}: {r.status_code} {r.reason}: {r.text[:200]}")
|
raise Exception(f"POST {path}: {r.status_code} {r.reason}: {r.text[:200]}")
|
||||||
result = {}
|
result = {}
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ from routes.main import bp as main_bp
|
|||||||
from routes.api import bp as api_bp
|
from routes.api import bp as api_bp
|
||||||
from routes.api_test import bp as api_test_bp
|
from routes.api_test import bp as api_test_bp
|
||||||
|
|
||||||
VERSION = "1.0.31"
|
VERSION = "1.0.33"
|
||||||
|
|
||||||
app = Flask(__name__, template_folder="templates", static_folder="static")
|
app = Flask(__name__, template_folder="templates", static_folder="static")
|
||||||
app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-dev.ngcloud.ru/api/v1/svc")
|
app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-dev.ngcloud.ru/api/v1/svc")
|
||||||
|
|||||||
@@ -103,6 +103,9 @@ def api_test():
|
|||||||
for pid, pval in params.items():
|
for pid, pval in params.items():
|
||||||
client.post("/instanceOperationCfsParams",
|
client.post("/instanceOperationCfsParams",
|
||||||
{"instanceOperationUid": op_uid, "svcOperationCfsParamId": int(pid), "paramValue": str(pval)})
|
{"instanceOperationUid": op_uid, "svcOperationCfsParamId": int(pid), "paramValue": str(pval)})
|
||||||
|
# GET /validate-cfs, затем POST /run
|
||||||
|
client.get(f"/instanceOperations/{op_uid}/validate-cfs")
|
||||||
|
client.post(f"/instanceOperations/{op_uid}/run")
|
||||||
|
|
||||||
# wait
|
# wait
|
||||||
deadline = time.time() + 300
|
deadline = time.time() + 300
|
||||||
|
|||||||
Reference in New Issue
Block a user