private String getHeaderName ( String name , Map < String , Object > receivedHeaders , TestContext context , HeaderValidationContext validationContext ) { String headerName = context . resolveDynamicValue ( name ) ; if ( ! receivedHeaders . containsKey ( headerName ) && validationContext . isHeaderNameIgnoreCase ( ) ) { String key = headerName ; log . debug ( String . format ( "Finding case insensitive header for key '%s'" , key ) ) ; headerName = receivedHeaders . entrySet ( ) . parallelStream ( ) . filter ( item -> item . getKey ( ) . equalsIgnoreCase ( key ) ) . map ( Map . Entry :: getKey ) . findFirst ( ) . orElseThrow ( ( ) -> new ValidationException ( "Validation failed: No matching header for key '" + key + "'" ) ) ; log . info ( String . format ( "Found matching case insensitive header name: %s" , headerName ) ) ; } return headerName ; }
Get header name from control message but also check if header expression is a variable or function . In addition to that find case insensitive header name in received message when feature is activated .