Skip to content

Retry & Timeout

Automatically retry a request when it fails with a 5xx server error.

@retry 3
@name Flaky Endpoint
GET {{baseUrl}}/unstable-endpoint

This retries up to 3 times on 5xx errors.

Add a delay (in milliseconds) between retries:

@retry 5 delay 1000
@name Critical Payment
POST {{baseUrl}}/payment
Content-Type: application/json
{
"amount": 99.99
}

This retries up to 5 times, waiting 1 second between each attempt.

Set a maximum time (in milliseconds) for a request to complete:

@timeout 5000
@name Slow Report
GET {{baseUrl}}/heavy-report

If the request takes longer than 5 seconds, it will be aborted.

You can set default retry and timeout values in @config:

@config
timeout: 5000
retries: 2
###
@name Normal Request
GET {{baseUrl}}/users
###
@timeout 30000
@name Very Slow Request
GET {{baseUrl}}/export

The first request uses the config defaults (5s timeout, 2 retries). The second overrides the timeout to 30 seconds.