diff --git a/core/src/main/java/com/predic8/membrane/core/interceptor/misc/SetHeaderInterceptor.java b/core/src/main/java/com/predic8/membrane/core/interceptor/misc/SetHeaderInterceptor.java index 50692f6fd..fc976ac5c 100644 --- a/core/src/main/java/com/predic8/membrane/core/interceptor/misc/SetHeaderInterceptor.java +++ b/core/src/main/java/com/predic8/membrane/core/interceptor/misc/SetHeaderInterceptor.java @@ -83,10 +83,11 @@ public Outcome handleResponse(Exchange exc) throws Exception { } private Outcome handleMessage(Exchange exchange, Message msg) { - if (!ifAbsent || !msg.getHeader().contains(name)) { - msg.getHeader().setValue(name, evaluateExpression(new ExchangeEvaluationContext(exchange, msg).getStandardEvaluationContext())); + if (msg.getHeader().contains(name) && ifAbsent) { + return CONTINUE; } + msg.getHeader().setValue(name, evaluateExpression(new ExchangeEvaluationContext(exchange, msg).getStandardEvaluationContext())); return CONTINUE; }