hurl/integration/tests_ok/retry_until_200.py
2023-06-04 07:15:59 +00:00

18 lines
348 B
Python

# return 500 by default
# or 200 if previous request has been executed less than 5 second ago
from app import app
import time
last = 0
@app.route("/retry/until-200")
def retry_until_200():
global last
current = time.time()
interval = current - last
last = current
if interval < 5:
return "OK", 200
return "", 500