node-jenkins-api icon indicating copy to clipboard operation
node-jenkins-api copied to clipboard

error when I use the all_builds

Open Richardsh opened this issue 3 years ago • 2 comments

the code is below jenkins.all_builds('xxxx', 'id,timestamp,result,actions[*]', function(err, data) { if (err){ console.log('err1', err); } console.log('data',data) }); it runs error and returns ‘Server returned unexpected status code: 400’

but when I use last build it works successfully

jenkins.last_build_info('xxxx', function(err, data) { if (err){ return console.log('err1', err); } console.log(data) });

who can tell me how to solve or the reason is about jenkins set not my code's problem

Richardsh avatar Jul 14 '21 08:07 Richardsh

this error is caused by the invalid character, you can find '[]' this two is invalid in tomcat of the request url api/json?tree=allBuilds[id,timestamp,result,duration]. for the temporary solution, you can wrap the biuldUrl function by encodeURI in the lib/main.js of line 309. or you can overwrite this allBuilds function by yourself.

see311 avatar May 04 '22 01:05 see311

this error is caused by the invalid character, you can find '[]' this two is invalid in tomcat of the request url api/json?tree=allBuilds[id,timestamp,result,duration]. for the temporary solution, you can wrap the biuldUrl function by encodeURI in the lib/main.js of line 309. or you can overwrite this allBuilds function by yourself.

But this solution may caused another issue, that the params of build-with-params also be encode

see311 avatar May 23 '22 05:05 see311