2024-10-19 22:22:12 +02:00
|
|
|
[client] # HTTP client configuration
|
2024-10-20 02:06:10 +02:00
|
|
|
user_agent = "postwoman@sample/0.3.1"
|
2024-10-20 01:33:20 +02:00
|
|
|
timeout = 60 # max time for each request to complete, in seconds
|
|
|
|
redirects = 5 # allow up to five redirects, defaults to none
|
2024-10-19 04:13:42 +02:00
|
|
|
|
2024-10-19 22:22:12 +02:00
|
|
|
[env] # these will be replaced in routes options. environment vars overrule these
|
2024-10-19 20:36:08 +02:00
|
|
|
PW_TOKEN = "set-me-as-and-environment-variable!"
|
|
|
|
|
2024-10-19 04:12:46 +02:00
|
|
|
|
2024-10-19 04:55:20 +02:00
|
|
|
|
2024-10-19 22:22:12 +02:00
|
|
|
[route.healthcheck] # the simplest possible route: just name and url
|
|
|
|
url = "https://api.alemi.dev/"
|
2024-10-19 22:02:05 +02:00
|
|
|
|
2024-10-19 04:12:46 +02:00
|
|
|
[route.debug]
|
|
|
|
url = "https://api.alemi.dev/debug"
|
2024-10-19 22:22:12 +02:00
|
|
|
method = "PUT" # specify request method
|
|
|
|
query = [ # specify query parameters in a more friendly way
|
2024-10-19 19:24:12 +02:00
|
|
|
"body=json",
|
|
|
|
"cache=0"
|
|
|
|
]
|
2024-10-19 22:22:12 +02:00
|
|
|
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
|
2024-10-19 04:12:46 +02:00
|
|
|
|
2024-10-19 04:13:42 +02:00
|
|
|
[route.payload]
|
|
|
|
url = "https://api.alemi.dev/debug"
|
|
|
|
method = "POST"
|
|
|
|
body = '''{
|
|
|
|
"complex": {
|
|
|
|
"json": "payloads",
|
|
|
|
"can": "be",
|
|
|
|
"expressed": "this",
|
|
|
|
"way": true
|
|
|
|
}
|
|
|
|
}'''
|
2024-10-19 22:22:12 +02:00
|
|
|
extract = { type = "body" } # get the whole response body, this is the default extractor
|
2024-10-19 04:13:42 +02:00
|
|
|
|
2024-10-19 04:12:46 +02:00
|
|
|
[route.cookie]
|
|
|
|
url = "https://api.alemi.dev/getcookie"
|
|
|
|
method = "GET"
|
2024-10-19 22:22:12 +02:00
|
|
|
extract = { type = "header", key = "Set-Cookie" } # get a specific response header, ignoring body
|