I would want to add headers only when the request.user.agent is not null.
How to achieve it?
<AssignMessage continueOnError="false" enabled="true" name="add-headers-1">
<Add>
<Headers>
<Header name="user-agent">{request.user.agent}</Header>
</Headers>
</Add>
<AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>
It is a header, so you can add conditional check like (request.header.User-Agent
== null) OR (request.header.User-Agent
== "") & assign if missing.
Ref:
https://docs.apigee.com/api-platform/reference/variables-reference
https://docs.apigee.com/api-platform/fundamentals/flow-variables-and-conditions