karate

Masking authorisation header in Karate log and report


I have read through log masking section in the karate document => https://github.com/karatelabs/karate#log-masking

However, I still could not find any example that allows me to mask the authorization header in the API request.

(I tried to modify the DemoLogModifier class but I don't think I get it right) see here

Would be great if someone can show me the working code.

Thank you.


Solution

  • There is already an example here: DemoLogModifier.java and here: headers-masking.feature

    I suggest you can implement enableForUri() as follows to start with:

    @Override
    public boolean enableForUri(String uri) {
        return true;
    }
    

    Maybe that's all you need, because you probably want to mask all URLs.