Assign Message Policy Header Removal not working as per Documentation

Observing 2 issues while deleting the Header using Assign Message Policy.

Scenario:

issue: 1
As per Documentation https://cloud.google.com/apigee/docs/api-platform/reference/policies/assign-message-policy?hl=en#syn...

Using below config in AM policy

  <Remove>
    <Headers>
      <Header name="KIRAN">xyzzy</Header>
    </Headers>
  </Remove>

Header is being wiped out even when header KIRAN is "fefewgew" ideally as per documentation header KIRAN should be wiped of only if value is "xyzzy".

Issue: 2

The other scenario is we are using APIGEE LINTER and with above config we are getting P0034(value between the Header should be boolean), Can you check and help us with the same.

@dchiesa1 please check once

1 1 69
1 REPLY 1

The syntax example in the documentation is wrong. There should be no VALUE inside Remove/Headers/Header. 

The behavior of Remove/Headers/Header is to remove the named header. The policy does not consider the value of the header that it removes. There is no way to configure AssignMessage to remove a Header conditionally, depending on the value of the header.

re:  P0034(value between the Header should be boolean)

Yes, Apigeelint is telling you the value should be true or false.  True, means "remove the header".  False means "do not remove the header".  

If you omit the value, it defaults to true. 

So use this: 

<AssignMessage name='AM-Example'>
  <Remove>
    <Headers>
      <Header name='name-of-header-to-remove'/>
      <!-- the following also works, but is unnecessarily more verbose -->
      <Header name='another-header-to-remove'>true</Header> <!-- disrecommended -->
    </Headers>
   ...

I see no reason why you would ever want to use "false" as a value. Why include the header in the Remove/Headers/Header, if you don't want to remove it?