[client] # HTTP client configuration user_agent = "postwoman@sample/0.4.0" timeout = 60 # max time for each request to complete, in seconds redirects = 5 # allow up to five redirects, defaults to none base = "https://api.alemi.dev" # all route urls will be appended to this base [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 path path = "/" [route.debug] path = "/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 = { type = "body" } # get the whole response body, this is the default extractor [route.benchmark] path = "/look/into/the/void" extract = { type = "discard" } # if you don't care about the output, discard it! [route.notfound] path = "https://cdn.alemi.dev/does-not-exist" absolute = true # mark as absolute to avoid composing with client base url status = 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] path = "/debug" method = "POST" body = '''{ "complex": { "json": "payloads", "can": "be", "expressed": "this", "way": true } }''' extract = ".path" # extract from json responses with JQ syntax (default extractor), equivalent to `{ type = "jq", query = ".path" }` expect = "/debug" # if extracted result doesn't match, this route will return an error [route.cookie] path = "/getcookie" method = "GET" extract = { type = "header", key = "Set-Cookie" } # get a specific response header, ignoring body