Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass a range of validResponseCodes for Jenkins pipeline httpRequest method

How to pass a range of validResponseCodes for Jenkins pipeline's httpRequest method?

Here is the reference for this method: https://jenkins.io/doc/pipeline/steps/http_request/#httprequest-perform-an-http-request-and-return-a-response-object

Documentation says its a string. And no more examples are provided.

I would like the valid response codes to be 200 - 400 and build not to fail because of the response code 400.

like image 573
raitisd Avatar asked Sep 15 '25 16:09

raitisd


1 Answers

validResponseCodes should be an interval from:to or a single value. In your case it would be

httpRequest url: someUrl, validResponseCodes: '200:400'

See HttpRequest class for more information.

Also, based on the source code, it looks like it's possible to specify ranges and singe values separated by a comma. e.g. 200:400,409

like image 107
Vitalii Vitrenko Avatar answered Sep 18 '25 05:09

Vitalii Vitrenko