Example Configuration
api:
port: 2000
flow:
- response:
- setHeader:
name: X-Powered-By
value: Membrane
- setHeader:
name: X-Method
value: ${method}
- return:
status: 200
api:
port: 2000
flow:
- response:
- setHeader:
name: X-Powered-By
value: Membrane
- setHeader:
name: X-Method
value: ${method}
- return:
status: 200
Syntax
setHeader:
'$ref': <string>
failOnError: <boolean>
ifAbsent: <boolean>
language: groovy
name: <string>
value: <string>
xmlConfig: {}
setHeader:
'$ref': <string>
failOnError: <boolean>
ifAbsent: <boolean>
language: groovy
name: <string>
value: <string>
xmlConfig: {}
Attributes
| Name | Required | Default | Description | Examples |
|---|---|---|---|---|
| $ref | false | - | Reference a component defined under components. | - |
| failOnError | false | true | When true, aborts processing if expression evaluation fails. When false, logs the error and continues unchanged. | false |
| ifAbsent | false | false | When true, only sets the field if it is not already present in the message. | true |
| language | false | SpEL | Scripting language used to evaluate the value expression. | SpEL | groovy | jsonpath | xpath |
| name | false | - | Name of the header field or exchange property key to set. | X-Powered-By |
| value | false | - | Value to assign, evaluated as a SpEL template expression by default. Use the language attribute to switch to Groovy, JsonPath, or XPath.XPath and JSONPath query the body. An empty body, or one of another media type, is evaluated as an empty document, so the expression finds nothing, as when the queried element or field is missing. A body that should be XML or JSON but does not parse is an error: 400 in the request, 502 in the response, unless | ${method} |
Child Structure
| Element | Cardinality | Description |
|---|---|---|
| xmlConfig | 0..1 | XML namespace declarations for XPath expressions in the value. |