Tenemos debajo de los comandos curl que funcionan perfectamente.
curl -x http://xxxx:9999 -X POST -F token=aaa -F "ref=prod_call" -F variables[name]="No" -F variables[CR_Number]="" -F variables[HOSTS_FILE] = "lil.ini" https://gitlab.com/api/v4/projects/1111/trigger/pipeline
Ahora lo mismo que implementé en el nodo js y desafortunadamente no funciona
function callPipeline(){ console.log("The host we are going to execute here") console.log("The command are going to execute here") var formdata = new FormData(); formdata.append("token", "aaa"); formdata.append("ref", "prod_call"); formdata.append("variables[name]", "No"); formdata.append("variables[CR_Number]", ""); formdata.append("variables[HOSTS_FILE]", "lil.ini"); var options = { method: 'POST', host: "xxxx", //proxy server port: 9999, path: "https://gitlab.com/api/v4/projects/1111/trigger/pipeline", body: formdata, }; return new Promise((resolve, reject) => { http.request(options, function(res, err) { console.log(res); console.log(err); //res.pipe(process.stdout); resolve(res.toString() + "---err---" +err.toString()) }); }) }Obtener error
node:events:498 throw er; // Unhandled 'error' event ^ Error: socket hang up at connResetException (node:internal/errors:691:14) at Socket.socketOnEnd (node:_http_client:466:23) at Socket.emit (node:events:532:35) at endReadableNT (node:internal/streams/readable:1346:12) at processTicksAndRejections (node:internal/process/task_queues:83:21) Emitted 'error' event on ClientRequest instance at: at Socket.socketOnEnd (node:_http_client:466:9) at Socket.emit (node:events:532:35) at endReadableNT (node:internal/streams/readable:1346:12) at processTicksAndRejections (node:internal/process/task_queues:83:21) { code: 'ECONNRESET' }