Work With Headers

You can use Groovy scripts to modify headers of requests, as well as get headers from responses. This topic describes how to use a Groovy script to work with HTTP headers.

Add header to request

Where to use

You can run this script as the RequestFilter.filterRequest event handler.

Example

The following code demonstrates how to add a custom HTTP header to requests from within the event handler:

Save response header value to property

Where to use

As a Groovy Script test step.

Example

The following code demonstrates how to save a response header value to a test case property:

Add hashed authentication header

Where to use

You can run this script as the RequestFilter.filterRequest event handler.

Example

The following code demonstrates how to add an authentication header to requests from the event handler:

See Also

Publication date: