Important
The Message Content assertion has been superseded by the Smart Assertion as of ReadyAPI 3.9.0. The assertions will continue to be available, but we recommend transitioning to Smart Assertions.
The HTTP Header Equals assertion checks whether the header exists in the request or response and has the value you need.
Important
This assertion works with test steps and virtual APIs that receive HTTP messages.
This assertion is available in multiple ReadyAPI applications. Depending on the application, it validates the following data:
In... | Checks... | To learn more... |
---|---|---|
The request or response header. | ||
The response header. | See Security Assertions. | |
The request header. |
Specify the header name in the Header field.
Specify the expected header value in the Value edit box.
Select additional options to narrow down the expected value:
Option
Description
Ignore case
Make the search case insensitive.
Regular Expression
Treat the entered value as a regular expression.
To learn more about the syntax of regular expressions, see the Oracle documentation.
The following assertion checks if the response has the
Content-Type
header with theapplication/json
value:Header
Value
RegEx
Content-Type
application/json
No
The following assertion will pass if the response has the
Content-Type
header with theapplication/json
orapplication/xml
value:Header
Value
RegEx
Content-Type
application/(json|xml)
Yes
The following assertion checks if the format of the
Date
header complies with the standard:Header
Value
RegEx
Date
[a-zA-Z]{3}, \d{2} [a-zA-Z]{3}, \d{4} \d{2}:\d{2}:\d{2} GMT
Yes
The following assertion checks if the server sends the
PHPSESSID
cookie and sets a valid lifetime for it in seconds:Header
Value
RegEx
Set-Cookie
PHPSESSID=\w*;.*Max-Age=\d*
Yes
Add more assertions for HTTP status codes and response headers: