Core Step verifyHeader
Description
Verifies that the current response contains the specified HTTP Header.
Parameters
- name
- Required? yes
- The name of the Http Response Header of interest.
- text
- Required? yes
- The expected header value.
- description
- Required? no
- The description of this test step.
- regex
- Required? no, default is 'false'
- Specifies whether the text value represents a regular expression.
Inline Text
The inline text is all the text between the start tag ( <verifyHeader> ) and the end tag ( </verifyHeader> ), including blanks, tabs or newlines. Using a pair of start/end tags ( <verifyHeader> </verifyHeader> ) has not the same behavior than the seemingly equivalent empty element tag ( <verifyHeader/> ).
- Required? no
- Alternative way to set both name and text attributes separated by a semicolon like "Content-Type: text/html".
Details
Examples
simple verifyHeader example
<webtest name="validate gif content header">
<config ...>
<invoke description="Load Image" url="ok.gif"/>
<verifyHeader description="should be a gif image"
name="Content-Type"
text="image/gif"/>
</webtest>
<config ...>
<invoke description="Load Image" url="ok.gif"/>
<verifyHeader description="should be a gif image"
name="Content-Type"
text="image/gif"/>
</webtest>
The following example checks the content type, but excludes the charset that might follow the mime type.
verifyHeader regex example
<webtest name="validate content header">
<config ...>
<invoke description="Get Document" url="foo.html"/>
<verifyHeader description="should be a html doc with any (or no) charset"
regex="true"
name="Content-Type"
text="text/html.*"/>
</webtest>
<config ...>
<invoke description="Get Document" url="foo.html"/>
<verifyHeader description="should be a html doc with any (or no) charset"
regex="true"
name="Content-Type"
text="text/html.*"/>
</webtest>