Author: August 5, 2016. ,
The “Http request” block is used to call a url with an http or https request and optionally use the response data. This can be useful in many scenarios, including retrieving test data from another system or sending data to a REST API endpoint.
See the HTTP Request lesson to see examples of how to monitor a web site and how to call a REST API.
Fully expanded, the “Http request” block looks like this:
The Block Header (“Http Request”)
The green input connector in the header is used to trigger the block to start executing.
The green output connector in the header triggers when the http(s) request is completed, either successfully, with an error or after a timeout.
The title of the block (“Http request”) can be changed by double-clicking on it and typing in a new title.
The url to perform the http(s) request against. For instance, https://leaptest.com. Right-click in the text and select “Insert token” to insert a field that has been added below.
Text fields (for Url)
Add any number of fields that can contain dynamic content and be used as tokens in the url.
A semicolon-delimited list of request headers. Right-click in the text and select “Insert token” to insert a field that has been added below.
Text fields (for Headers)
Add any number of fields that can contain dynamic content and be used as tokens in the headers.
The request method. Supported methods include GET, POST, PUT and DELETE.
For requests using the POST or PUT methods, the body is used to send data (such as forms data) along with the request.
After the http(s) request is completed, the response property contains all information about the response. This includes the status code, response headers, body and how long it took to complete the request.
If the request fails, the response property will be empty.
The http status code returned as a result of the request.
The semicolon-separated http headers returned as a result of the request.
The response body (html, json, xml, etc) returned as a result of the request.
The time in milliseconds from the request is sent until the last byte of the response was received.
The maximum time spent waiting for the http(s) request to complete before giving up and triggering the green output connector (see above).
The default value is 10 seconds.