Appearance
How the Endpoint Response is Decided
Each task produces its own result and status code, but the endpoint's HTTP response isn't simply the last task's. After the tasks have run, the response is chosen in this order - the first match wins:
- HTTP Redirect task - the caller is redirected.
- Task with
Retain status codeenabled - that task's status code is returned, with the HTTP Response task's body and headers if there is one, otherwise that task's own body. - HTTP Response task - its configured status code, body and headers.
- Otherwise:
- if
Stop on Task Failurestopped the endpoint, the failed task's status code and body. - if not,
200with the results of every task. This includes when tasks failed butStop on Task Failureis off.
- if
Which tasks count
Tasks that were never reached, because
Stop on Task Failurestopped the endpoint first, are ignored.Skipped tasks still count, and return a
200with a result that says why they were skipped:Disabled by filter - behaviour was not run: one of the task's filters evaluated tofalse. For JSONPath filters, this means the path didn't match anything in the data.Disabled - behaviour was not run: the task is disabled in the endpoint editor.
So if a skipped task has
Retain status codeenabled, the endpoint returns200, even if an earlier task that ran returned something else. And if the endpoint has no HTTP Response task, these messages appear in the results it returns.
As Stop on Task Failure is on by default, a failing task's status code is usually what's returned - it halts the endpoint before any later HTTP Response task runs.
Other cases
- An endpoint with no HTTP Request, HTTP Response, HTTP Redirect, SMS, Fax or PDF tasks (e.g. only Mapping or Email tasks) always returns the results of every task, even when
Stop on Task Failurestopped it. - If a task raises an error rather than failing (for example an HTTP Response Handler schema validation failure), an error response is returned instead.