52 lines
1.7 KiB
TOML
52 lines
1.7 KiB
TOML
[client] # HTTP client configuration
|
|
user_agent = "postwoman@sample/0.2.0"
|
|
|
|
[env] # these will be replaced in routes options. environment vars overrule these
|
|
PW_TOKEN = "set-me-as-and-environment-variable!"
|
|
|
|
|
|
|
|
[route.healthcheck] # the simplest possible route: just name and url
|
|
url = "https://api.alemi.dev/"
|
|
|
|
[route.debug]
|
|
url = "https://api.alemi.dev/debug"
|
|
method = "PUT" # specify request method
|
|
query = [ # specify query parameters in a more friendly way
|
|
"body=json",
|
|
"cache=0"
|
|
]
|
|
headers = [ # add custom headers to request
|
|
"Content-Type: application/json",
|
|
"Authorization: Bearer ${PW_TOKEN}",
|
|
]
|
|
body = { hello = "world!", success = true } # body can be a bare string, or an inline table (will be converted to json)
|
|
extract = ".path" # extract from json responses with JQ syntax
|
|
# note that a bare extractor string is equivalent to `{ type = "jq", query = ".path" }`
|
|
|
|
[route.benchmark]
|
|
url = "https://api.alemi.dev/look/into/the/void"
|
|
extract = { type = "discard" } # if you don't care about the output, discard it!
|
|
|
|
[route.notfound]
|
|
url = "https://api.alemi.dev/not-found"
|
|
expect = 404 # it's possible to specify expected status code, will fail if doesn't match
|
|
extract = { type = "regex", pattern = 'nginx/[0-9\.]+' } # extract from response with regex
|
|
|
|
[route.payload]
|
|
url = "https://api.alemi.dev/debug"
|
|
method = "POST"
|
|
body = '''{
|
|
"complex": {
|
|
"json": "payloads",
|
|
"can": "be",
|
|
"expressed": "this",
|
|
"way": true
|
|
}
|
|
}'''
|
|
extract = { type = "body" } # get the whole response body, this is the default extractor
|
|
|
|
[route.cookie]
|
|
url = "https://api.alemi.dev/getcookie"
|
|
method = "GET"
|
|
extract = { type = "header", key = "Set-Cookie" } # get a specific response header, ignoring body
|