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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With