update elixForms runner to emit form-data content for easier update
This commit is contained in:
+39
-6
@@ -47,12 +47,13 @@ runtime:
|
||||
|
||||
if (requestId === undefined)
|
||||
{
|
||||
console.log(bru.getVar("elixFormsQueryOutput"));
|
||||
console.log("Undefined");
|
||||
console.log("Undefined, printing vars:");
|
||||
//console.log(bru.getVar("elixFormsQueryOutput"));
|
||||
console.log(bru.getVar("elixFormsWebKitFormOutput"));
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("Calling method with requestId: " + requestId);
|
||||
//console.log("Calling method with requestId: " + requestId);
|
||||
req.setUrl(req.getUrl().replace(":request_id", requestId));
|
||||
}
|
||||
- type: after-response
|
||||
@@ -73,6 +74,14 @@ runtime:
|
||||
}
|
||||
const jsonOutput = JSON.parse(bru.getVar("elixFormsQueryOutput"));
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
if (!bru.hasVar("elixFormsWebKitFormOutput"))
|
||||
{
|
||||
console.error("Post: NO elixFormsWebKitFormOutput FOUND!");
|
||||
}
|
||||
var webKitFormOutput = bru.getVar("elixFormsWebKitFormOutput");
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
// Get response data
|
||||
const request = res.getBody().value.request;
|
||||
const idRequest = request.idRequest ?? 0;
|
||||
@@ -91,23 +100,47 @@ runtime:
|
||||
const jsonElement = JSON.parse(stringElement);
|
||||
|
||||
jsonOutput.push(jsonElement);
|
||||
|
||||
|
||||
bru.setVar("elixFormsQueryOutput", JSON.stringify(jsonOutput));
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
webKitFormOutput += "------WebKitFormBoundary0123456789abcdef\r\n";
|
||||
webKitFormOutput += "Content-Disposition: form-data; name=\"S_341_" + recordId + "_COL0118\"\r\n";
|
||||
webKitFormOutput += "\r\n";
|
||||
webKitFormOutput += responsabiliCsv + "\r\n";
|
||||
webKitFormOutput += "------WebKitFormBoundary0123456789abcdef\r\n";
|
||||
webKitFormOutput += "Content-Disposition: form-data; name=\"S_341_" + recordId + "_COL0119\"\r\n";
|
||||
webKitFormOutput += "\r\n";
|
||||
webKitFormOutput += contraentiCsv + "\r\n";
|
||||
|
||||
bru.setVar("elixFormsWebKitFormOutput", webKitFormOutput);
|
||||
// --------------------------------------------------------------------------------
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("Cannot retrieve recordId from request");
|
||||
console.log("Cannot retrieve recordId from request " + idRequest);
|
||||
};
|
||||
|
||||
// Set next request if needed
|
||||
if (requestIndex < requestIds.length - 1)
|
||||
if (requestIndex < requestIds.length - 1 && requestIndex < 3)
|
||||
{
|
||||
bru.setVar("elixFormsQueryRequestIndex", requestIndex + 1);
|
||||
bru.runner.setNextRequest("Get request details");
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("JSON object:");
|
||||
console.log(JSON.stringify(jsonOutput));
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
webKitFormOutput += "------WebKitFormBoundary0123456789abcdef--\r\n";
|
||||
|
||||
bru.setVar("elixFormsWebKitFormOutput", webKitFormOutput);
|
||||
|
||||
console.log("--------------------------------------------------------------------------------");
|
||||
console.log("WebKitForm:");
|
||||
console.log(JSON.stringify(webKitFormOutput));
|
||||
// --------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
settings:
|
||||
|
||||
+11
-2
@@ -5,7 +5,7 @@ info:
|
||||
|
||||
http:
|
||||
method: GET
|
||||
url: "{{elixFormsApiUrl_Default}}/request/lookup/by-status?requestStatus=SUBMITTED&requestStatus=IN_PROGRESS&moduleTag=PROPOSTA_CCT_OPERATORE"
|
||||
url: "{{elixFormsApiUrl_Default}}/request/lookup/by-status?requestStatus=IN_PROGRESS&moduleTag=PROPOSTA_CCT_OPERATORE"
|
||||
headers:
|
||||
- name: x-requested-with
|
||||
value: XMLHttpRequest
|
||||
@@ -21,6 +21,7 @@ http:
|
||||
- SUBMITTED
|
||||
- PROCESSED
|
||||
possibile selezionare valori multipli
|
||||
disabled: true
|
||||
- name: requestStatus
|
||||
value: IN_PROGRESS
|
||||
type: query
|
||||
@@ -50,6 +51,10 @@ runtime:
|
||||
bru.deleteVar("elixFormsQueryRequestIndex");
|
||||
bru.deleteVar("elixFormsQueryOutput");
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
bru.deleteVar("elixFormsWebKitFormOutput");
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
// Carica il file JSON (sostituisci con il tuo oggetto JSON)
|
||||
const jsonData = res.getBody();
|
||||
const requests = jsonData.value.requests;
|
||||
@@ -58,11 +63,15 @@ runtime:
|
||||
{
|
||||
requestIds.push(r.requestId);
|
||||
}
|
||||
console.log(requestIds);
|
||||
//console.log(requestIds);
|
||||
bru.setVar("elixFormsQueryRequestIds", requestIds);
|
||||
bru.setVar("elixFormsQueryRequestIndex", 0);
|
||||
bru.setVar("elixFormsQueryOutput", JSON.stringify(JSON.parse("[]")));
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
bru.setVar("elixFormsWebKitFormOutput", "");
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
settings:
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
|
||||
Reference in New Issue
Block a user