added SimpleHeaderPolicy test when no source HEADER found
MODIFY
simple-header-policy/src/test/java/io/apiman/plugins/simpleheaderpolicy/SimpleHeaderPolicyTest.java
simple-header-policy/src/test/java/io/apiman/plugins/simpleheaderpolicy/SimpleHeaderPolicyTest.java
@@ -250,6 +250,23 @@ public class SimpleHeaderPolicyTest {
assertEquals(2, request.getHeaders().size());
}
+ @Test
+ public void shouldGetValueFromRequestButNoHeader() {
+ AddHeaderBean header = spy(new AddHeaderBean());
+
+ header.setHeaderName("the-target-header");
+ header.setHeaderValue("the-header-to-read-from");
+ header.setOverwrite(true);
+ header.setApplyTo(ApplyTo.REQUEST);
+ header.setValueType(ValueType.HEADER);
+ config.getAddHeaders().add(header);
+
+ policy.apply(request, mContext, config, mRequestChain);
+
+ assertNull(request.getHeaders().get("the-target-header"));
+ assertEquals(0, request.getHeaders().size());
+ }
+
@Test
public void shouldStripHeaderWithKey() {
request.getHeaders().put("vanish", "begone");

added SimpleHeaderPolicy test when no source HEADER found