Contact Free trial Login

Testing Adding/Removing headers Custom Policy example

To test the execution of policies, follow the steps in this section to apply a policy and use curl, for example curl http://localhost:8081 -vvv to test the policies.

Adding Request Header Policy

The procedure for testing the add or remove request header policies assume that you created a mule application that logs the headers received by the backend service.

  1. Apply the add request header policy to add a header as described in the previous section.

  2. Run curl.

  3. Check the log of the backend service to verify that request includes the additional header name and value you configured in step 1.

Removing Request Header Policy

The procedure for testing the remove request header policy assumes that you created a mule application that logs the headers received by the backend service.

  1. Apply the remove request header policy to remove a header as described in the previous section.

  2. Run curl.

  3. Verify that the backend service excludes the extra header by checking the log.

Adding Response Header Policy

  1. Run curl.

  2. Check the response to see which headers are being received by the client.

  3. Apply the add response header policy to add a response to the header.

  4. Run curl again.

  5. Verify that the specified header is received.

Removing Response Header Policy

  1. Run curl.

  2. Check the response to see which headers are being received by the client.

  3. Apply the remove response header policy to remove a response from the header.

  4. Run curl again.

  5. Verify that the specified header is removed.

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.