Skip to content

Request loops (e.g. for polling) #1720

Answered by jcamiel
riesinger asked this question in Ideas
Discussion options

You must be logged in to vote

Hi @riesinger could you use the --retry option (either with the command line or with an option section)?

For instance:

# Create a new job
POST http://api.example.org/jobs

HTTP 201
[Captures]
job_id: jsonpath "$.id"
[Asserts]
jsonpath "$.state" == "RUNNING"


# Pull job status until it is completed
GET http://api.example.org/jobs/{{job_id}}
[Options]
retry: 10   # maximum number of retry, -1 for unlimited

HTTP 200
[Asserts]
jsonpath "$.state" == "COMPLETED"

Basically, --retry will retry a request until all asserts (explicit and implicit like status code) are OK. So, you can make a condition on the response body and indefinitely loop until this condition is met. See the documentation on …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@riesinger
Comment options

Answer selected by riesinger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants