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:

ModeDescription
codedefault Returns the HTTP response code.
substrAllows the use of regular expression to extract information from the response body.
jsonParses the response body as JSON and allows looking for a value trough the object.
headerReturns the specified header of the response.
durationReturns the execution time of the request.
geodurationReturns 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:

ParameterDescription
regexstring Regular expression to match against the response body. Used in substr mode.
path or propertystring 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.
headerstring Extract specific header from the response object. Used in header mode.
onecurl_idUUID References OneCurl object to get request parameters from.
follow_redirects1 or 0 Allow request to follow the redirect. By default 1
validate_cert1 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'