choose

Version

Enables conditional branching. Evaluates {@link Case} elements in order and runs the first matching flow. If no case matches, an optional trailing {@link Otherwise} is executed. The "otherwise" element must be the last element of the list.
api:
port: 2000
flow:
- choose:
- case:
test: headers['X-Foo'] != null
flow:
- return:
status: 200
- case:
test: headers['X-Bar'] != null
flow:
- return:
status: 300
- otherwise:
- return:
status: 400
api:
   port: 2000
   flow:
     - choose:
         - case:
             test: headers['X-Foo'] != null
             flow:
               - return:
                   status: 200
         - case:
             test: headers['X-Bar'] != null
             flow:
               - return:
                   status: 300
         - otherwise:
             - return:
                 status: 400

Syntax

choose:
- <choices>
choose:
  - <choices>

Child Structure

ElementCardinalityDescription
choices0..*Sets the list of choices. The choices can include "case" and "otherwise" elements to define conditional flows.

Can be used in