You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The http-request task offers a parameter to validate the response body against a regex, but the http status code is not provided or checked.
This differs from the httpget task, which raises a Build failure if the response code is not 200.
It would be useful to have a way to validate that the response-code matched expectations. This could be implemented in a similar way to the responseRegex parameter.
<!-- Accept any 2xx response as valid. -->
<http-requesturl="http://example.com/"responseCodeRegex="/^2\d{2}$/" />
The text was updated successfully, but these errors were encountered:
The httpget task will throw a build exception, but the http-request task doesn't check the status code in any way, so even if it encounters an error, it doesn't stop the build.
In retrospect, you're right: my particular use-case is covered by the http condition (I'm pinging a server before attempting a large number of requests).
The PR may potentially be useful to other use-cases though (e.g. using http-request to post to an API, and verify something like a 201).
The
http-request
task offers a parameter to validate the response body against a regex, but the http status code is not provided or checked.This differs from the
httpget
task, which raises a Build failure if the response code is not 200.It would be useful to have a way to validate that the response-code matched expectations. This could be implemented in a similar way to the
responseRegex
parameter.The text was updated successfully, but these errors were encountered: