probek6

http

Probe an endpoint to make sure it responds to an http request with the expected HTTP status code

Activity as code

Below are the details and signature of the activity Python module.

Typeprobe
Modulechaosk6.probes
Namehttp
Returnboolean

Usage

JSON

{
  "name": "http",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk6.probes",
    "func": "http",
    "arguments": {
      "endpoint": ""
    }
  }
}

YAML

name: http
provider:
  arguments:
    endpoint: ""
  func: http
  module: chaosk6.probes
  type: python
type: probe

Arguments

NameTypeDefaultRequiredTitleDescription
endpointstringYesEndpointTarget endpoint
methodstring“GET”NoMethodHTTP method to apply
statusinteger200NoStatusExpected HTTP status code
bodystring""NoBodyHTTP request body to send
headersmappingnullNoHeadersHTTP request headers
vusinteger1NoVUsNumber of virtual users
durationstring""NoDurationHow long to run the test for
debugbooleanfalseNoDebugRun the test with the debug flag set
timeoutinteger1NoTimeoutHTTP requests timeout

Depending on the endpoint and your payload, this action might be destructive. Use with caution.

Signature

def http(endpoint: str,
         method: str = 'GET',
         status: int = 200,
         body: str = '',
         headers: dict = {},
         vus: int = 1,
         duration: str = '',
         debug: bool = False,
         timeout: int = 1) -> bool:
    pass