HTTP Tests

Quickstart#

The following example retrieves the HTTP response code of an HTTP call.

$ curl https://probe.onecheck.io/http-code?url=http://www.cnn.com

Exemple HTTP code

https://probe.onecheck.io/http-code?url=http://www.cnn.com&key=a1e5623c0d1c469b88924524d73ee02e

HTTP modes and sub-tests#

Execute HTTP requests with the Tornado HTTPClient class. The probe has several modes:

Mode Description
code default Returns the HTTP response code.
substr Allows the use of regular expression to extract information from the response body.
json Parses the response body as JSON and allows looking for a value trough the object.
header Returns the specified header of the response.
duration Returns the execution time of the request.
geoduration Returns the execution time of the request by querying multiple DNS servers for the geographic zone.

All parameters of the tornado.httpclient.HTTPRequest constructor are valid and can be used as arguments when submitting an http test. For convenience the mostly used are listed in the table below along with some extensions:

Parameter Description
regex string Regular expression to match against the response body. Used in substr mode.
path or property string The path to a value within an object. Used in json mode. Ex: servers[0].interfaces[0].ip_address would extract the value of the field ip_address.
header string Extract specific header from the response object. Used in header mode.
onecurl_id UUID References OneCurl object to get request parameters from.
follow_redirects 1 or 0 Allow request to follow the redirect. By default 1
validate_cert 1 or 0 Ask to validate the SSL certificate. By default 1

Examples#

The following example retrieves the Content-Type header of an HTTP response.

$ curl https://probe.onecheck.io/http-header?url=http%3A%2F%2Fscaleflex.cloud&method=GET&header=Content-Type'