When creating a custom assertion you may want to retrieve the headers of the http request within that assertion.
That works fine, as long as the headers are part of the original request.
If any header gets added within the policy before calling the custom assertion using the "Manage Transport Headers/Properties assertion", that added header will not be picked up.
This is due to the nature of the Manage Transport Headers/Properties assertion.
To check on the header you would use the CustomHttpHeadersKnob in your custom assertion. But it is designed to work with internal http servlet request/response messages directly.
Whereas, Manage Transport Headers/Properties assertion uses an intermediate HeadersKnob which will not reflect the changes to underlying http request/response messages immediately. It keeps the changes with it till the message is ready for transport.
A possible workaround is to retrieve http header context variables using CustomPolicyContext in ServiceInvocation class. CustomPolicyContext provides a methods to get values of context variables.
Object obj = customPolicyContext.getVariable("request.http.allheadervalues"); // String
Object obj = customPolicyContext.getVariable("request.http.headernames"); // String
Object obj = customPolicyContext.getVariable("request.http.header.<header_name>"); // String
More details on transport layer context variables can be found here: https://docops.ca.com/ca-api-gateway/9-3/en/reference/context-variables/transport-layer-context-variables