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 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://www.leapwork.com. Right-click in the text and select “Insert token” to insert a field that has been added below.
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.
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.
Any certificate exposed by the destination URL as part of SSL handshake should be accepted if Accept certificate is checked.
The maximum time spent waiting for the HTTP(s) request to complete before giving up and triggering the green output connector (see above).
If the 'Default Timeout' property checkbox is not selected, then the timeout value is 30 seconds. If the 'Default Timeout' property checkbox is selected, then the 'Default timeout' value selected in the flow settings will be applicable.
This connector is triggered, if the request to the web server fails. Fails means, that for some reason, the HTTP Request block never received a HTTP Response code, which can be caused by many different reasons. Examples are:
- The web server being unavailable
- The machine where the flow is executed has no network connection
- The web server responds so slow, that the maximum time allowed - specified in the Timeout property - is exceeded.