VSTS release pipeline release gate: how to do HTTP response body string equality check?

Viewed 741

I want to check whether my deployed ASP.NET application returns Healthy from health check endpoints or not.

Unfortunately, the success criteria samples of the "Invoke Rest API" release gate only show how to evaluate JSON responses like eq(root['status'], 'successful') or eq(count(jsonpath('Items[?(@.price<50)]')).

As my endpoint doesn't return any JSON I wonder if it's possible to do a simple stupid string equality check somehow?

Of course I could rely on checking the HTTP status code, I feel like it should be possible to access the response body.

This is the exception I get when using eq(root, "Healthy"):

log output when using eq root

2 Answers

If your endpoint returns just a string try simply this:

eq(root, 'SomeString')

This is really strange that you get such error. It works on my release pipeline:

Here is settings: enter image description here

And here result:

enter image description here

Agree with Krzysztof Madej

Exception Message: Error parsing API response into a JSON object.

You could check the “URL suffix and parameters” field in “Invoke Rest API task”.

Please make sure that the whole URL is valid.

The whole URL contains the Server URL (Set in service connection) and the URL suffix and parameters (Set in Invoke Rest API task).

Hope this helps.

Related