Webtest WebTest GitHub Home

Core Step storeHeader

Description

Provides the ability to store an HTTP Header value for later checking

Most of the time, it is more straightforward to simply use the verifyHeader step directly. The primary rationale for explitly storing a header value in a property is to include the property value in a future invoke step, or if verification needs to be deferred after the stored response has been replaced with a new one.

In short, prefer verifyHeader to a storeHeader + verifyProperty combination.

Parameters

name
Required? yes
The name of the Http Response Header of interest. If the property name is not specified, the header name is used as key to store the value found.
description
Required? no
The description of this test step.
property
Required? no
The name of the property in which to store the retrieved value.
propertyType
Required? no, default is the "defaultPropertyType" as specified in the "config" element is used.
The type of the property in which to store the retrieve value. Either "ant" or "dynamic".

Details

storeHeader Example
<webtest name="httpHeader: confirm usage of storeHeader">
    <config ...>
    <steps>
        <invoke description="Load Imageurl="ok.gif"/>
        <storeHeader description="store content-type"
            name="Content-Typeproperty="contentType" />
        <verifyProperty description="should be a gif image"
            name="contentTypetext="image/gif"/>
    </steps>
</webtest>